@@ -188,7 +188,7 @@ public void EndpointUtilityThrowsWhenCreatingBlobStoreReferenceForCDNUriIfUriIsV
188188 "https://anystorage.blob.core.windows.net/" ) ]
189189 //
190190 [ TestCase (
191- "https://anystorage.blob.core.windows.net?sv=2022-11-02&ss=b&srt=co&sp=rtf&se=2024-07-02T05:15:29Z&st=2024-07-01T21:15:29Z&spr=https" ,
191+ "https://anystorage.blob.core.windows.net?sv=2022-11-02&ss=b&srt=co&sp=rtf&se=2024-07-02T05:15:29Z&st=2024-07-01T21:15:29Z&spr=https" ,
192192 "https://anystorage.blob.core.windows.net/?sv=2022-11-02&ss=b&srt=co&sp=rtf&se=2024-07-02T05:15:29Z&st=2024-07-01T21:15:29Z&spr=https" ) ]
193193 //
194194 [ TestCase (
@@ -230,7 +230,7 @@ public void EndpointUtilityCreatesTheExpectedBlobStoreReferenceForConnectionStri
230230
231231 [ Test ]
232232 [ TestCase ( "https://any.service.azure.com?miid=307591a4-abb2-4559-af59-b47177d140cf" , "https://any.service.azure.com" ) ]
233- [ TestCase ( "https://any.service.azure.com/?miid=307591a4-abb2-4559-af59-b47177d140cf" , "https://any.service.azure.com/" ) ]
233+ [ TestCase ( "https://any.service.azure.com/?miid=307591a4-abb2-4559-af59-b47177d140cf" , "https://any.service.azure.com/" ) ]
234234 public void EndpointUtilityCreatesTheExpectedBlobStoreReferenceForUrisReferencingManagedIdentities ( string uri , string expectedUri )
235235 {
236236 DependencyBlobStore store = EndpointUtility . CreateBlobStoreReference (
@@ -338,7 +338,7 @@ public void EndpointUtilityCreatesTheExpectedBlobStoreReferenceForConnectionStri
338338 Assert . IsNotNull ( store . Credentials ) ;
339339 Assert . IsInstanceOf < ClientCertificateCredential > ( store . Credentials ) ;
340340 }
341-
341+
342342 [ Test ]
343343 [ TestCase ( "https://any.service.azure.com/?cid=307591a4-abb2-4559-af59-b47177d140cf&tid=985bbc17-e3a5-4fec-b0cb-40dbb8bc5959&crti=ABC&crts=any.domain.com" , "https://any.service.azure.com/" ) ]
344344 [ TestCase ( "https://any.service.azure.com/?cid=307591a4-abb2-4559-af59-b47177d140cf&tid=985bbc17-e3a5-4fec-b0cb-40dbb8bc5959&crti=ABC CA 01&crts=any.domain.com" , "https://any.service.azure.com/" ) ]
@@ -854,5 +854,37 @@ public void CreateKeyVaultStoreReference_ConnectionString_ThrowsOnInvalid()
854854 "InvalidConnectionString" ,
855855 this . mockFixture . CertificateManager . Object ) ) ;
856856 }
857+
858+ [ Test ]
859+ [ TestCase ( "https://anyvault.vault.azure.net/?cid=123456&tid=654321" ) ]
860+ [ TestCase ( "https://anycontentstorage.blob.core.windows.net?cid=123456&tid=654321" ) ]
861+ [ TestCase ( "https://anypackagestorage.blob.core.windows.net?tid=654321" ) ]
862+ [ TestCase ( "https://anynamespace.servicebus.windows.net?cid=123456&tid=654321" ) ]
863+ [ TestCase ( "https://my-keyvault.vault.azure.net/?;tid=654321" ) ]
864+ public void TryParseMicrosoftEntraTenantIdReference_Uri_WorksAsExpected ( string input )
865+ {
866+ // Arrange
867+ Uri uri = new Uri ( input ) ;
868+ bool result = EndpointUtility . TryParseMicrosoftEntraTenantIdReference ( uri , out string actualTenantId ) ;
869+
870+ // Assert
871+ Assert . True ( result ) ;
872+ Assert . AreEqual ( "654321" , actualTenantId ) ;
873+ }
874+
875+ [ Test ]
876+ [ TestCase ( "https://anycontentstorage.blob.core.windows.net?cid=123456&tenantId=654321" ) ]
877+ [ TestCase ( "https://anypackagestorage.blob.core.windows.net?miid=654321" ) ]
878+ [ TestCase ( "https://my-keyvault.vault.azure.net/;cid=654321" ) ]
879+ public void TryParseMicrosoftEntraTenantIdReference_Uri_ReturnFalseWhenInvalid ( string input )
880+ {
881+ // Arrange
882+ Uri uri = new Uri ( input ) ;
883+ bool result = EndpointUtility . TryParseMicrosoftEntraTenantIdReference ( uri , out string actualTenantId ) ;
884+
885+ // Assert
886+ Assert . IsFalse ( result ) ;
887+ Assert . IsNull ( actualTenantId ) ;
888+ }
857889 }
858890}
0 commit comments