Inheritance: SubscriptionCmdletBase, IModuleAssemblyInitializer
        public void CanAddAccountToCustomProfile()
        {
            var cmdlet = new AddAzureAccount();
            var csmSubscription = Guid.NewGuid();
            var rdfeSubscription = Guid.NewGuid();
            var credential = GenerateCredential("mySillyPassword");
            var profile = new AzureProfile();
            var client = new ProfileClient(profile);
            cmdlet.Credential = credential;
            cmdlet.Profile = profile;
            cmdlet.SetParameterSet("User");

            AzureSession.ClientFactory =
            new MockClientFactory(
               new List<object>
                        {
                            ProfileClientHelper.CreateRdfeSubscriptionClient(rdfeSubscription, rdfeSubscription.ToString()),
                            ProfileClientHelper.CreateCsmSubscriptionClient(new List<string>{csmSubscription.ToString()}, 
                            new List<string>{csmSubscription.ToString(), rdfeSubscription.ToString()})
                        }, true);
            AzureSession.AuthenticationFactory = new MockTokenAuthenticationFactory(credential.UserName,
                Guid.NewGuid().ToString());
            cmdlet.CommandRuntime = commandRuntimeMock;
            cmdlet.InvokeBeginProcessing();
            cmdlet.ExecuteCmdlet();
            cmdlet.InvokeEndProcessing();
            Assert.NotNull(profile.Subscriptions);
            Assert.NotNull(profile.Accounts);
            Assert.NotNull(profile.Environments);
            Assert.NotNull(profile.Context);
            Assert.Equal(profile.Subscriptions.Values.Count((s) => s.Id == csmSubscription), 1);
            Assert.Equal(profile.Subscriptions.Values.Count((s) => s.Id == rdfeSubscription), 1);
            Assert.Equal(profile.Accounts.Values.Count((s) => s.Id == credential.UserName), 1);
            Assert.Contains(rdfeSubscription.ToString(), profile.Accounts.First().Value.GetProperty(AzureAccount.Property.Subscriptions));
            Assert.Contains(csmSubscription.ToString(), profile.Accounts.First().Value.GetProperty(AzureAccount.Property.Subscriptions));
            Assert.Equal(profile.Context.Account.Id, credential.UserName);
            Assert.Equal(profile.Context.Subscription.Id, rdfeSubscription);
        }
        public void AddAzureAccountThrowsForEmptySubscriptions()
        {
            var cmdlet = new AddAzureAccount();
            var csmSubscription = Guid.NewGuid();
            var rdfeSubscription = Guid.NewGuid();
            var credential = GenerateCredential("mySillyPassword");
            var profile = new AzureSMProfile();
            var client = new ProfileClient(profile);
            cmdlet.Credential = credential;
            cmdlet.Profile = profile;
            cmdlet.SetParameterSet("User");

            AzureSession.ClientFactory =
            new MockClientFactory(
               new List<object>
                        {
                            ProfileClientHelper.CreateRdfeSubscriptionClient(rdfeSubscription),
                            ProfileClientHelper.CreateCsmSubscriptionClient(new List<string>(),
                            new List<string>{csmSubscription.ToString(), rdfeSubscription.ToString()})
                        }, true);
            AzureSession.AuthenticationFactory = new MockTokenAuthenticationFactory(credential.UserName,
                Guid.NewGuid().ToString());
            cmdlet.CommandRuntime = commandRuntimeMock;
            cmdlet.InvokeBeginProcessing();
            Assert.Throws<ArgumentException>(() => cmdlet.ExecuteCmdlet());
        }