Exemple #1
0
        public async Task GetSubscriptionShouldThrowIfFailed()
        {
            var currentUserAccount = CreateAccount();
            IAzureAuthenticationManager accountManager = await CreateAccountManager(currentUserAccount, null, true);

            await Assert.ThrowsAsync <ServiceFailedException>(() => accountManager.GetSelectedSubscriptionsAsync());
        }
Exemple #2
0
        public async Task GetSubscriptionShouldThrowWhenUserNeedsAuthentication()
        {
            var currentUserAccount = CreateAccount();

            currentUserAccount.Account.IsStale = true;
            IAzureAuthenticationManager accountManager = await CreateAccountManager(currentUserAccount, null);

            await Assert.ThrowsAsync <ExpiredTokenException>(() => accountManager.GetSelectedSubscriptionsAsync());
        }
Exemple #3
0
        public async Task GetSubscriptionShouldReturnEmptyWhenUserIsNotSignedIn()
        {
            IAzureAuthenticationManager accountManager = await CreateAccountManager(null, null);

            IEnumerable <IAzureUserAccountSubscriptionContext> result =
                await accountManager.GetSelectedSubscriptionsAsync();

            Assert.False(result.Any());
        }
Exemple #4
0
        public async Task GetSubscriptionShouldReturnTheListSuccessfully()
        {
            List <IAzureUserAccountSubscriptionContext> subscriptions = new List <IAzureUserAccountSubscriptionContext> {
                new Mock <IAzureUserAccountSubscriptionContext>().Object
            };
            var currentUserAccount = CreateAccount();
            IAzureAuthenticationManager accountManager = await CreateAccountManager(currentUserAccount, subscriptions, false);

            IEnumerable <IAzureUserAccountSubscriptionContext> result =
                await accountManager.GetSelectedSubscriptionsAsync();

            Assert.True(result.Any());
        }