@@ -589,8 +589,8 @@ public async Task BatchRequestContent_AddBatchRequestStepWithBaseRequestToBatchR
589589 [ InlineData ( "https://graph.microsoft.com/beta/me" , "/me" ) ]
590590 [ InlineData ( "https://graph.microsoft.com/v1.0/users/abcbeta123@wonderemail.com/events" , "/users/abcbeta123@wonderemail.com/events" ) ]
591591 [ InlineData ( "https://graph.microsoft.com/beta/users/abcbeta123@wonderemail.com/events" , "/users/abcbeta123@wonderemail.com/events" ) ]
592- [ InlineData ( "https://graph.microsoft.com/v1.0/users?$filter=identities/any(id:id/issuer%20eq%20'$74707853-18b3-411f-ad57-2ef65f6fdeb0'%20and%20id/issuerAssignedId%20eq%20'**bobbetancourt@fakeemail.com**')" , "/users?$filter=identities/any(id:id/issuer%20eq%20 '$74707853-18b3-411f-ad57-2ef65f6fdeb0'%20and%20id /issuerAssignedId%20eq%20 '**bobbetancourt@fakeemail.com**')" ) ]
593- [ InlineData ( "https://graph.microsoft.com/beta/users?$filter=identities/any(id:id/issuer%20eq%20'$74707853-18b3-411f-ad57-2ef65f6fdeb0'%20and%20id/issuerAssignedId%20eq%20'**bobbetancourt@fakeemail.com**')&$top=1" , "/users?$filter=identities/any(id:id/issuer%20eq%20 '$74707853-18b3-411f-ad57-2ef65f6fdeb0'%20and%20id /issuerAssignedId%20eq%20 '**bobbetancourt@fakeemail.com**')&$top=1" ) ]
592+ [ InlineData ( "https://graph.microsoft.com/v1.0/users?$filter=identities/any(id:id/issuer%20eq%20'$74707853-18b3-411f-ad57-2ef65f6fdeb0'%20and%20id/issuerAssignedId%20eq%20'**bobbetancourt@fakeemail.com**')" , "/users?$filter=identities/any(id:id/issuer eq '$74707853-18b3-411f-ad57-2ef65f6fdeb0' and id /issuerAssignedId eq '**bobbetancourt@fakeemail.com**')" ) ]
593+ [ InlineData ( "https://graph.microsoft.com/beta/users?$filter=identities/any(id:id/issuer%20eq%20'$74707853-18b3-411f-ad57-2ef65f6fdeb0'%20and%20id/issuerAssignedId%20eq%20'**bobbetancourt@fakeemail.com**')&$top=1" , "/users?$filter=identities/any(id:id/issuer eq '$74707853-18b3-411f-ad57-2ef65f6fdeb0' and id /issuerAssignedId eq '**bobbetancourt@fakeemail.com**')&$top=1" ) ]
594594 public async Task BatchRequestContent_AddBatchRequestStepWithBaseRequestProperlySetsVersion ( string requestUrl , string expectedUrl )
595595 {
596596 // Arrange
@@ -607,12 +607,34 @@ public async Task BatchRequestContent_AddBatchRequestStepWithBaseRequestProperly
607607 requestContent = await reader . ReadToEndAsync ( ) ;
608608 }
609609
610- var expectedContent = "{\" requests\" :[{\" id\" :\" 1\" ,\" url\" :\" " + expectedUrl + "\" ,\" method\" :\" GET\" }]}" ;
610+ var expectedContent = "{\" requests\" :[{\" id\" :\" 1\" ,\" url\" :\" " + expectedUrl + "\" ,\" method\" :\" GET\" }]}" ;
611611
612-
613- // Assert we added successfully and contents are as expected
612+ // Assert we added successfully and contents are as expected and URI is not encoded
614613 Assert . Equal ( expectedContent , System . Text . RegularExpressions . Regex . Unescape ( requestContent ) ) ;
615614 }
616615
616+ [ Theory ]
617+ [ InlineData ( "https://graph.microsoft.com/v1.0/drives/b%21ynG/items/74707853-18b3-411f-ad57-2ef65f6fdeb0:/test.txt:/textfilecontentbytes" , "/drives/b!ynG/items/74707853-18b3-411f-ad57-2ef65f6fdeb0:/test.txt:/textfilecontentbytes" ) ]
618+ public async Task BatchRequestContent_AddBatchRequestPutStepWithBaseRequestProperlyEncodedURI ( string requestUrl , string expectedUrl )
619+ {
620+ // Arrange
621+ BatchRequestStep batchRequestStep = new BatchRequestStep ( "1" , new HttpRequestMessage ( HttpMethod . Put , requestUrl ) ) ;
622+ BatchRequestContent batchRequestContent = new BatchRequestContent ( client ) ;
623+ Assert . False ( batchRequestContent . BatchRequestSteps . Any ( ) ) ; //Its empty
624+
625+ // Act
626+ batchRequestContent . AddBatchRequestStep ( batchRequestStep ) ;
627+ var requestContentStream = await batchRequestContent . GetBatchRequestContentAsync ( ) ;
628+ string requestContent ;
629+ using ( StreamReader reader = new StreamReader ( requestContentStream ) )
630+ {
631+ requestContent = await reader . ReadToEndAsync ( ) ;
632+ }
633+
634+ var expectedContent = "{\" requests\" :[{\" id\" :\" 1\" ,\" url\" :\" " + expectedUrl + "\" ,\" method\" :\" PUT\" }]}" ;
635+
636+ // Assert we added successfully and contents are as expected and URI is not encoded
637+ Assert . Equal ( expectedContent , System . Text . RegularExpressions . Regex . Unescape ( requestContent ) ) ;
638+ }
617639 }
618640}
0 commit comments