@@ -491,7 +491,7 @@ public async Task IWireMockAdminApi_GetMappingAsync_WithProxy_And_ProxyUrlReplac
491
491
492
492
server . Stop ( ) ;
493
493
}
494
-
494
+
495
495
[ Fact ]
496
496
public async Task IWireMockAdminApi_GetRequestsAsync_Json ( )
497
497
{
@@ -862,16 +862,45 @@ public async Task IWireMockAdminApi_GetMappingsCode()
862
862
var guid2 = Guid . Parse ( "1b731398-4a5b-457f-a6e3-d65e541c428f" ) ;
863
863
var guid3 = Guid . Parse ( "f74fd144-df53-404f-8e35-da22a640bd5f" ) ;
864
864
var guid4 = Guid . Parse ( "4126DEC8-470B-4EFF-93BB-C24F83B8B1FD" ) ;
865
+ var guid5 = Guid . Parse ( "c9929240-7ae8-4a5d-8ed8-0913479f6eeb" ) ;
865
866
var server = WireMockServer . StartWithAdminInterface ( ) ;
866
867
868
+ server
869
+ . Given (
870
+ Request . Create ( )
871
+ . WithPath ( "/users/post1" )
872
+ . UsingPost ( )
873
+ . WithBody ( new JsonMatcher ( new
874
+ {
875
+ city = "Amsterdam" ,
876
+ country = "The Netherlands"
877
+ } ) )
878
+ )
879
+ . WithGuid ( guid1 )
880
+ . RespondWith ( Response . Create ( ) ) ;
881
+
882
+ server
883
+ . Given (
884
+ Request . Create ( )
885
+ . WithPath ( "/users/post2" )
886
+ . UsingPost ( )
887
+ . WithBody ( new JsonPartialMatcher ( new
888
+ {
889
+ city = "City" ,
890
+ country = "Country"
891
+ } ) )
892
+ )
893
+ . WithGuid ( guid2 )
894
+ . RespondWith ( Response . Create ( ) . WithBody ( "Line1\r \n Some \" value\" in Line2" ) ) ;
895
+
867
896
server
868
897
. Given (
869
898
Request . Create ( )
870
899
. WithPath ( "/foo1" )
871
900
. WithParam ( "p1" , "xyz" )
872
901
. UsingGet ( )
873
902
)
874
- . WithGuid ( guid1 )
903
+ . WithGuid ( guid3 )
875
904
. RespondWith (
876
905
Response . Create ( )
877
906
. WithStatusCode ( 200 )
@@ -886,7 +915,7 @@ public async Task IWireMockAdminApi_GetMappingsCode()
886
915
. WithHeader ( "h1" , "W/\" 234f2q3r\" " )
887
916
. UsingPost ( )
888
917
)
889
- . WithGuid ( guid2 )
918
+ . WithGuid ( guid4 )
890
919
. RespondWith (
891
920
Response . Create ( )
892
921
. WithStatusCode ( "201" )
@@ -901,36 +930,43 @@ public async Task IWireMockAdminApi_GetMappingsCode()
901
930
. WithUrl ( "https://localhost/test" )
902
931
. UsingDelete ( )
903
932
)
904
- . WithGuid ( guid3 )
933
+ . WithGuid ( guid5 )
905
934
. RespondWith (
906
935
Response . Create ( )
907
936
. WithStatusCode ( HttpStatusCode . AlreadyReported )
908
- . WithBodyAsJson ( new { @as = 1 , b = 1.2 , d = true , e = false , f = new [ ] { 1 , 2 , 3 , 4 } , g = new { z1 = 1 , z2 = 2 , z3 = new [ ] { "a" , "b" , "c" } , z4 = new [ ] { new { a = 1 , b = 2 } , new { a = 2 , b = 3 } } } , date_field = new DateTime ( 2023 , 05 , 08 , 11 , 20 , 19 ) , string_field_with_date = "2021-03-13T21:04:00Z" , multiline_text = @"This
937
+ . WithBodyAsJson ( new
938
+ {
939
+ @as = 1 ,
940
+ b = 1.2 ,
941
+ d = true ,
942
+ e = false ,
943
+ f = new [ ] { 1 , 2 , 3 , 4 } ,
944
+ g = new
945
+ {
946
+ z1 = 1 ,
947
+ z2 = 2 ,
948
+ z3 = new [ ] { "a" , "b" , "c" } ,
949
+ z4 = new [ ]
950
+ {
951
+ new { a = 1 , b = 2 } ,
952
+ new { a = 2 , b = 3 }
953
+ }
954
+ } ,
955
+ date_field = new DateTime ( 2023 , 05 , 08 , 11 , 20 , 19 ) ,
956
+ string_field_with_date = "2021-03-13T21:04:00Z" ,
957
+ multiline_text = @"This
909
958
is
910
959
multiline
911
960
text
912
- " } )
913
- ) ;
914
-
915
- server
916
- . Given (
917
- Request . Create ( )
918
- . WithPath ( "/foo3" )
919
- . WithBody ( new JsonPartialMatcher ( new { a = 1 , b = 2 } ) )
920
- . UsingPost ( )
921
- )
922
- . WithGuid ( guid4 )
923
- . RespondWith (
924
- Response . Create ( )
925
- . WithStatusCode ( 200 )
926
- . WithBody ( "Line1\r \n Some \" value\" in Line2" )
961
+ "
962
+ } )
927
963
) ;
928
964
929
965
// Act
930
966
var api = RestClient . For < IWireMockAdminApi > ( server . Url ) ;
931
967
932
968
var mappings = await api . GetMappingsAsync ( ) . ConfigureAwait ( false ) ;
933
- mappings . Should ( ) . HaveCount ( 4 ) ;
969
+ mappings . Should ( ) . HaveCount ( 5 ) ;
934
970
935
971
var code = await api . GetMappingsCodeAsync ( ) . ConfigureAwait ( false ) ;
936
972
0 commit comments