@@ -661,5 +661,295 @@ public async Task AssetTags_CaseSensitivityVerification_ShouldTestCaseBehavior_T
661661 }
662662 }
663663 }
664+
665+ [ Fact ]
666+ public void Query_MultipleCalls_ShouldMergeQueries_Test ( )
667+ {
668+ // Arrange
669+ AssetLibrary assetLibrary = client . AssetLibrary ( ) ;
670+ JObject firstQuery = new JObject
671+ {
672+ { "filename" , "test1.png" } ,
673+ { "content_type" , "image/png" }
674+ } ;
675+ JObject secondQuery = new JObject
676+ {
677+ { "file_size" , 1024 } ,
678+ { "tags" , new JArray { "test" , "image" } }
679+ } ;
680+
681+ // Act
682+ var result = assetLibrary . Query ( firstQuery ) . Query ( secondQuery ) ;
683+
684+ // Assert
685+ Assert . NotNull ( result ) ;
686+ Assert . IsType < AssetLibrary > ( result ) ;
687+ // The method should not throw an exception when called multiple times
688+ }
689+
690+ [ Fact ]
691+ public void Query_SingleCall_ShouldWorkAsBefore_Test ( )
692+ {
693+ // Arrange
694+ AssetLibrary assetLibrary = client . AssetLibrary ( ) ;
695+ JObject queryObject = new JObject
696+ {
697+ { "filename" , "test.png" }
698+ } ;
699+
700+ // Act
701+ var result = assetLibrary . Query ( queryObject ) ;
702+
703+ // Assert
704+ Assert . NotNull ( result ) ;
705+ Assert . IsType < AssetLibrary > ( result ) ;
706+ }
707+
708+ [ Fact ]
709+ public void Query_WithEmptyObject_ShouldNotThrowException_Test ( )
710+ {
711+ // Arrange
712+ AssetLibrary assetLibrary = client . AssetLibrary ( ) ;
713+ JObject emptyQuery = new JObject ( ) ;
714+
715+ // Act & Assert
716+ var result = assetLibrary . Query ( emptyQuery ) ;
717+ Assert . NotNull ( result ) ;
718+ Assert . IsType < AssetLibrary > ( result ) ;
719+ }
720+
721+ [ Fact ]
722+ public void Query_WithNullValues_ShouldHandleGracefully_Test ( )
723+ {
724+ // Arrange
725+ AssetLibrary assetLibrary = client . AssetLibrary ( ) ;
726+ JObject queryWithNulls = new JObject
727+ {
728+ { "filename" , "test.png" } ,
729+ { "null_field" , null }
730+ } ;
731+
732+ // Act & Assert
733+ var result = assetLibrary . Query ( queryWithNulls ) ;
734+ Assert . NotNull ( result ) ;
735+ Assert . IsType < AssetLibrary > ( result ) ;
736+ }
737+
738+ [ Fact ]
739+ public void Query_ChainedWithOtherMethods_ShouldWork_Test ( )
740+ {
741+ // Arrange
742+ AssetLibrary assetLibrary = client . AssetLibrary ( ) ;
743+ JObject queryObject = new JObject
744+ {
745+ { "filename" , "test.png" }
746+ } ;
747+
748+ // Act
749+ var result = assetLibrary
750+ . Query ( queryObject )
751+ . Limit ( 10 )
752+ . Skip ( 0 )
753+ . IncludeMetadata ( ) ;
754+
755+ // Assert
756+ Assert . NotNull ( result ) ;
757+ Assert . IsType < AssetLibrary > ( result ) ;
758+ }
759+
760+ [ Fact ]
761+ public void Query_MultipleCallsWithSameKeys_ShouldMergeValues_Test ( )
762+ {
763+ // Arrange
764+ AssetLibrary assetLibrary = client . AssetLibrary ( ) ;
765+ JObject firstQuery = new JObject
766+ {
767+ { "tags" , new JArray { "tag1" , "tag2" } }
768+ } ;
769+ JObject secondQuery = new JObject
770+ {
771+ { "tags" , new JArray { "tag3" , "tag4" } }
772+ } ;
773+
774+ // Act
775+ var result = assetLibrary . Query ( firstQuery ) . Query ( secondQuery ) ;
776+
777+ // Assert
778+ Assert . NotNull ( result ) ;
779+ Assert . IsType < AssetLibrary > ( result ) ;
780+ // The method should handle merging arrays without throwing exceptions
781+ }
782+
783+ [ Fact ]
784+ public void Query_WithComplexNestedObjects_ShouldMergeCorrectly_Test ( )
785+ {
786+ // Arrange
787+ AssetLibrary assetLibrary = client . AssetLibrary ( ) ;
788+ JObject firstQuery = new JObject
789+ {
790+ { "metadata" , new JObject
791+ {
792+ { "author" , "John Doe" } ,
793+ { "version" , 1 }
794+ }
795+ }
796+ } ;
797+ JObject secondQuery = new JObject
798+ {
799+ { "metadata" , new JObject
800+ {
801+ { "department" , "IT" }
802+ }
803+ } ,
804+ { "filename" , "test.png" }
805+ } ;
806+
807+ // Act
808+ var result = assetLibrary . Query ( firstQuery ) . Query ( secondQuery ) ;
809+
810+ // Assert
811+ Assert . NotNull ( result ) ;
812+ Assert . IsType < AssetLibrary > ( result ) ;
813+ }
814+
815+ [ Fact ]
816+ public void Where_SingleCall_ShouldAddKeyValuePair_Test ( )
817+ {
818+ // Arrange
819+ AssetLibrary assetLibrary = client . AssetLibrary ( ) ;
820+ string key = "filename" ;
821+ string value = "test.png" ;
822+
823+ // Act
824+ var result = assetLibrary . Where ( key , value ) ;
825+
826+ // Assert
827+ Assert . NotNull ( result ) ;
828+ Assert . IsType < AssetLibrary > ( result ) ;
829+ }
830+
831+ [ Fact ]
832+ public void Where_MultipleCalls_ShouldAddMultipleKeyValuePairs_Test ( )
833+ {
834+ // Arrange
835+ AssetLibrary assetLibrary = client . AssetLibrary ( ) ;
836+
837+ // Act
838+ var result = assetLibrary
839+ . Where ( "filename" , "test.png" )
840+ . Where ( "content_type" , "image/png" )
841+ . Where ( "file_size" , "1024" ) ;
842+
843+ // Assert
844+ Assert . NotNull ( result ) ;
845+ Assert . IsType < AssetLibrary > ( result ) ;
846+ }
847+
848+ [ Fact ]
849+ public void Where_WithEmptyStrings_ShouldHandleGracefully_Test ( )
850+ {
851+ // Arrange
852+ AssetLibrary assetLibrary = client . AssetLibrary ( ) ;
853+
854+ // Act & Assert
855+ var result = assetLibrary . Where ( "" , "" ) ;
856+ Assert . NotNull ( result ) ;
857+ Assert . IsType < AssetLibrary > ( result ) ;
858+ }
859+
860+ [ Fact ]
861+ public void Where_WithNullKey_ShouldHandleGracefully_Test ( )
862+ {
863+ // Arrange
864+ AssetLibrary assetLibrary = client . AssetLibrary ( ) ;
865+
866+ // Act & Assert
867+ var result = assetLibrary . Where ( null , "value" ) ;
868+ Assert . NotNull ( result ) ;
869+ Assert . IsType < AssetLibrary > ( result ) ;
870+ }
871+
872+ [ Fact ]
873+ public void Where_WithNullValue_ShouldHandleGracefully_Test ( )
874+ {
875+ // Arrange
876+ AssetLibrary assetLibrary = client . AssetLibrary ( ) ;
877+
878+ // Act & Assert
879+ var result = assetLibrary . Where ( "key" , null ) ;
880+ Assert . NotNull ( result ) ;
881+ Assert . IsType < AssetLibrary > ( result ) ;
882+ }
883+
884+ [ Fact ]
885+ public void Where_ChainedWithOtherMethods_ShouldWork_Test ( )
886+ {
887+ // Arrange
888+ AssetLibrary assetLibrary = client . AssetLibrary ( ) ;
889+
890+ // Act
891+ var result = assetLibrary
892+ . Where ( "filename" , "test.png" )
893+ . Limit ( 10 )
894+ . Skip ( 0 )
895+ . IncludeMetadata ( ) ;
896+
897+ // Assert
898+ Assert . NotNull ( result ) ;
899+ Assert . IsType < AssetLibrary > ( result ) ;
900+ }
901+
902+ [ Fact ]
903+ public void Where_WithQueryMethod_ShouldWorkTogether_Test ( )
904+ {
905+ // Arrange
906+ AssetLibrary assetLibrary = client . AssetLibrary ( ) ;
907+ JObject queryObject = new JObject
908+ {
909+ { "content_type" , "image/png" }
910+ } ;
911+
912+ // Act
913+ var result = assetLibrary
914+ . Query ( queryObject )
915+ . Where ( "filename" , "test.png" )
916+ . Where ( "file_size" , "1024" ) ;
917+
918+ // Assert
919+ Assert . NotNull ( result ) ;
920+ Assert . IsType < AssetLibrary > ( result ) ;
921+ }
922+
923+ [ Fact ]
924+ public void Where_OverwritesExistingKey_ShouldReplaceValue_Test ( )
925+ {
926+ // Arrange
927+ AssetLibrary assetLibrary = client . AssetLibrary ( ) ;
928+
929+ // Act
930+ var result = assetLibrary
931+ . Where ( "filename" , "original.png" )
932+ . Where ( "filename" , "updated.png" ) ;
933+
934+ // Assert
935+ Assert . NotNull ( result ) ;
936+ Assert . IsType < AssetLibrary > ( result ) ;
937+ }
938+
939+ [ Fact ]
940+ public void Where_WithSpecialCharacters_ShouldHandleCorrectly_Test ( )
941+ {
942+ // Arrange
943+ AssetLibrary assetLibrary = client . AssetLibrary ( ) ;
944+
945+ // Act
946+ var result = assetLibrary
947+ . Where ( "file_name" , "test-file_123.png" )
948+ . Where ( "description" , "File with special chars: @#$%" ) ;
949+
950+ // Assert
951+ Assert . NotNull ( result ) ;
952+ Assert . IsType < AssetLibrary > ( result ) ;
953+ }
664954 }
665955}
0 commit comments