Exemple #1
0
 public void RequestParamsNullArg()
 {
     using (var harness = new MockHttpTestHarness(TestConstants.AuthorityHomeTenant))
     {
         AssertException.Throws <ArgumentNullException>(() => harness.CreateRequestParams(
                                                            null,
                                                            TestConstants.s_scope,
                                                            authorityOverride: AuthorityInfo.FromAuthorityUri(TestConstants.AuthorityHomeTenant, false)));
     }
 }
Exemple #2
0
        public async Task AuthorityValidationFailure_IsRethrown_Async()
        {
            // Arrange
            var validationException = new MsalServiceException(MsalError.InvalidInstance, "authority validation failed");

            _networkCacheMetadataProvider = new NetworkCacheMetadataProvider();

            // network fails with invalid_instance exception
            _networkMetadataProvider
            .When(x => x.GetMetadataAsync(Arg.Any <Uri>(), _testRequestContext))
            .Do(x => throw validationException);

            // Act
            var actualException = await AssertException.TaskThrowsAsync <MsalServiceException>(() =>
                                                                                               _discoveryManager.GetMetadataEntryAsync(
                                                                                                   AuthorityInfo.FromAuthorityUri("https://some_env.com/tid", true),
                                                                                                   _testRequestContext))
                                  .ConfigureAwait(false);

            // Assert
            Assert.AreSame(validationException, actualException);
            _knownMetadataProvider.DidNotReceiveWithAnyArgs();
        }
 public static Authority CreateAuthority(string authority, bool validateAuthority = false)
 {
     return(CreateAuthority(AuthorityInfo.FromAuthorityUri(authority, validateAuthority)));
 }
Exemple #4
0
 public static Authority CreateAuthority(IServiceBundle serviceBundle, string authority, bool validateAuthority = false)
 {
     return(CreateAuthorityWithOverride(
                serviceBundle,
                AuthorityInfo.FromAuthorityUri(authority, validateAuthority)));
 }