@@ -1881,7 +1881,10 @@ private void AfterCacheAccess(TokenCacheNotificationArgs args)
18811881 }
18821882
18831883 [ TestMethod ]
1884- public async Task AcquireTokenForClientAuthorityCheckTestAsync ( )
1884+ [ DataRow ( TestConstants . AuthorityCommonTenant ) ]
1885+ [ DataRow ( TestConstants . AuthorityOrganizationsTenant ) ]
1886+ [ DataRow ( TestConstants . AuthorityConsumersTenant ) ]
1887+ public async Task AcquireTokenForClientAuthorityCheckTestAsync ( string tenant )
18851888 {
18861889 using ( var httpManager = new MockHttpManager ( ) )
18871890 {
@@ -1895,32 +1898,29 @@ public async Task AcquireTokenForClientAuthorityCheckTestAsync()
18951898 . WithClientSecret ( TestConstants . ClientSecret )
18961899 . WithHttpManager ( httpManager )
18971900 . WithLogging ( ( LogLevel _ , string message , bool _ ) => log += message )
1901+ . WithAuthority ( tenant , true )
18981902 . BuildConcrete ( ) ;
18991903
1900- #pragma warning disable CS0618 // Type or member is obsolete
19011904 var result = await app
19021905 . AcquireTokenForClient ( TestConstants . s_scope )
1903- . WithAuthority ( TestConstants . AuthorityCommonTenant , true )
1904- . ExecuteAsync ( CancellationToken . None )
1905- . ConfigureAwait ( false ) ;
1906-
1907- Assert . IsTrue ( log . Contains ( MsalErrorMessage . ClientCredentialWrongAuthority ) ) ;
1908-
1909- log = string . Empty ;
1910- result = await app
1911- . AcquireTokenForClient ( TestConstants . s_scope )
1912- . WithAuthority ( TestConstants . AuthorityOrganizationsTenant , true )
19131906 . ExecuteAsync ( CancellationToken . None )
19141907 . ConfigureAwait ( false ) ;
1915- #pragma warning restore CS0618 // Type or member is obsolete
19161908
1917- Assert . IsTrue ( log . Contains ( MsalErrorMessage . ClientCredentialWrongAuthority ) ) ;
1909+ if ( tenant . Equals ( TestConstants . AuthorityConsumersTenant ) )
1910+ {
1911+ Assert . IsFalse ( log . Contains ( MsalErrorMessage . ClientCredentialWrongAuthority ) ) ;
1912+ }
1913+ else
1914+ {
1915+ Assert . IsTrue ( log . Contains ( MsalErrorMessage . ClientCredentialWrongAuthority ) ) ;
1916+ }
19181917 }
19191918 }
19201919
19211920 [ TestMethod ]
19221921 [ DataRow ( TestConstants . AuthorityCommonTenant ) ]
19231922 [ DataRow ( TestConstants . AuthorityOrganizationsTenant ) ]
1923+ [ DataRow ( TestConstants . AuthorityConsumersTenant ) ]
19241924 public async Task AcquireTokenOboAuthorityCheckTestAsync ( string tenant )
19251925 {
19261926 using ( var httpManager = new MockHttpManager ( ) )
@@ -1943,7 +1943,14 @@ public async Task AcquireTokenOboAuthorityCheckTestAsync(string tenant)
19431943 . ExecuteAsync ( CancellationToken . None )
19441944 . ConfigureAwait ( false ) ;
19451945
1946- Assert . IsTrue ( log . Contains ( MsalErrorMessage . OnBehalfOfWrongAuthority ) ) ;
1946+ if ( tenant . Equals ( TestConstants . AuthorityConsumersTenant ) )
1947+ {
1948+ Assert . IsFalse ( log . Contains ( MsalErrorMessage . OnBehalfOfWrongAuthority ) ) ;
1949+ }
1950+ else
1951+ {
1952+ Assert . IsTrue ( log . Contains ( MsalErrorMessage . OnBehalfOfWrongAuthority ) ) ;
1953+ }
19471954 }
19481955 }
19491956
0 commit comments