Example #1
0
        public async void MissingResource()
        {
            // Do not provide any resource parameter value
            var parameters = new SqlAppAuthenticationParameters($"{Constants.AzureAdInstance}{Constants.TenantId}", string.Empty, default(string));

            // Ensure exception is thrown when getting the token
            var exception = await Assert.ThrowsAsync <ArgumentException>(() => (new SqlAppAuthenticationProvider()).AcquireTokenAsync(parameters));

            Assert.Contains(Constants.SqlAppAuthProviderInvalidResource, exception.ToString());
        }
Example #2
0
        public async void InvalidAuthority()
        {
            // Provide authority parameter value that will not parse properly
            var parameters = new SqlAppAuthenticationParameters("http://badauthority", Constants.KeyVaultResourceId, default(string));

            // Ensure exception is thrown when getting the token
            var exception = await Assert.ThrowsAsync <ArgumentException>(() => (new SqlAppAuthenticationProvider()).AcquireTokenAsync(parameters));

            Assert.Contains(Constants.SqlAppAuthProviderInvalidAuthority, exception.ToString());
        }