Exemplo n.º 1
0
        public async Task GetSubscriptionShouldThrowIfFailed()
        {
            var currentUserAccount = CreateAccount();
            IAzureAuthenticationManager accountManager = await CreateAccountManager(currentUserAccount, null, true);

            await Assert.ThrowsAsync <ServiceFailedException>(() => accountManager.GetSelectedSubscriptionsAsync());
        }
Exemplo n.º 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());
        }
Exemplo n.º 3
0
        public async Task GetSubscriptionShouldReturnEmptyWhenUserIsNotSignedIn()
        {
            IAzureAuthenticationManager accountManager = await CreateAccountManager(null, null);

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

            Assert.False(result.Any());
        }
Exemplo n.º 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());
        }