public void TestSetDefaultSubscription()
        {
            var globalComponents = GlobalComponents.CreateFromPublishSettings(GlobalPathInfo.GlobalSettingsDirectory, null, Data.ValidPublishSettings.First());

            var setSubscriptionCommand = new SetSubscriptionCommandStub();

            // Check that current subscription is the default one
            Assert.AreEqual("Windows Azure Sandbox 9-220", setSubscriptionCommand.GetCurrentSubscription().SubscriptionName);

            // Change it and make sure it got changed
            setSubscriptionCommand.SetSubscriptionProcess("DefaultSubscription", null, null, null, null, "TestSubscription1", null, null);
            Assert.AreEqual("TestSubscription1", setSubscriptionCommand.GetCurrentSubscription().SubscriptionName);
            Assert.AreEqual("TestSubscription1", setSubscriptionCommand.GetSubscriptions(null).Values.Single(sub => sub.IsDefault).SubscriptionName);

            // Clean
            globalComponents.DeleteGlobalComponents();
        }
        public void TestUpdateSubscription()
        {
            var globalComponents = GlobalComponents.CreateFromPublishSettings(GlobalPathInfo.GlobalSettingsDirectory, null, Data.ValidPublishSettings.First());

            var setSubscriptionCommand = new SetSubscriptionCommandStub();

            // Check that current subscription is the default one
            Assert.AreEqual("Windows Azure Sandbox 9-220", setSubscriptionCommand.GetCurrentSubscription().SubscriptionName);

            // Change it and make sure it got changed
            setSubscriptionCommand.SetSubscriptionProcess("CommonSettings", "TestSubscription1", "newSubscriptionId", null, "newEndpoint", null, null, null);
            var updatedSubscription = setSubscriptionCommand.GetSubscriptions(null).Values.First(subscription => subscription.SubscriptionName == "TestSubscription1");

            Assert.AreEqual("newSubscriptionId", updatedSubscription.SubscriptionId);
            Assert.AreEqual("newEndpoint", updatedSubscription.ServiceEndpoint);

            // Clean
            globalComponents.DeleteGlobalComponents();
        }
Exemplo n.º 3
0
        public void TestCreateSubscription()
        {
            var globalComponents = GlobalComponents.CreateFromPublishSettings(GlobalPathInfo.GlobalSettingsDirectory, null, Data.ValidPublishSettings.First());

            var setSubscriptionCommand = new SetSubscriptionCommandStub();

            // Check that current subscription is the default one
            Assert.AreEqual("Windows Azure Sandbox 9-220", setSubscriptionCommand.GetCurrentSubscription().SubscriptionName);

            // Change it and make sure it got changed
            setSubscriptionCommand.SetSubscriptionProcess("CommonSettings", "newSubscription", "newSubscriptionId", null, "newEndpoint", null, "storage", null);
            var updatedSubscription = setSubscriptionCommand.GetSubscriptions(null).Values.First(subscription => subscription.SubscriptionName == "newSubscription");
            Assert.AreEqual("newSubscriptionId", updatedSubscription.SubscriptionId);
            Assert.AreEqual("newEndpoint", updatedSubscription.ServiceEndpoint);
            Assert.AreEqual("storage", updatedSubscription.CurrentStorageAccount);

            // Clean
            globalComponents.DeleteGlobalComponents();
        }
        public void TestCreateSubscriptionNoImport()
        {
            var setSubscriptionCommand = new SetSubscriptionCommandStub();

            // Check that we cant get a current subscription as there is no working directory
            Assert.IsNull(setSubscriptionCommand.GetCurrentSubscription());

            // Create a new subscription and a new working directory implicitly.
            var publishSettings = General.DeserializeXmlFile <PublishData>(Data.ValidPublishSettings.First(), string.Empty);
            var certificate     = new X509Certificate2(Convert.FromBase64String(publishSettings.Items[0].ManagementCertificate), string.Empty);

            setSubscriptionCommand.SetSubscriptionProcess("CommonSettings", "newSubscription", "newSubscriptionId", certificate, "newEndpoint", null, null, null);
            var updatedSubscription = setSubscriptionCommand.GetSubscriptions(null).Values.First(subscription => subscription.SubscriptionName == "newSubscription");

            Assert.AreEqual("newSubscriptionId", updatedSubscription.SubscriptionId);
            Assert.AreEqual("newEndpoint", updatedSubscription.ServiceEndpoint);

            // Clean
            var globalComponents = GlobalComponents.Load(GlobalPathInfo.GlobalSettingsDirectory);

            globalComponents.DeleteGlobalComponents();
        }
Exemplo n.º 5
0
        public void TestCreateSubscriptionNoImport()
        {
            var setSubscriptionCommand = new SetSubscriptionCommandStub();

            // Check that we cant get a current subscription as there is no working directory
            Assert.IsNull(setSubscriptionCommand.GetCurrentSubscription());

            // Create a new subscription and a new working directory implicitly.
            var publishSettings = General.DeserializeXmlFile<PublishData>(Data.ValidPublishSettings.First(), string.Empty);
            var certificate = new X509Certificate2(Convert.FromBase64String(publishSettings.Items[0].ManagementCertificate), string.Empty);

            setSubscriptionCommand.SetSubscriptionProcess("CommonSettings", "newSubscription", "newSubscriptionId", certificate, "newEndpoint", null, null, null);
            var updatedSubscription = setSubscriptionCommand.GetSubscriptions(null).Values.First(subscription => subscription.SubscriptionName == "newSubscription");
            Assert.AreEqual("newSubscriptionId", updatedSubscription.SubscriptionId);
            Assert.AreEqual("newEndpoint", updatedSubscription.ServiceEndpoint);

            // Clean
            var globalComponents = GlobalComponents.Load(GlobalPathInfo.GlobalSettingsDirectory);
            globalComponents.DeleteGlobalComponents();
        }
Exemplo n.º 6
0
        public void TestSetDefaultSubscription()
        {
            var globalComponents = GlobalComponents.CreateFromPublishSettings(GlobalPathInfo.GlobalSettingsDirectory, null, Data.ValidPublishSettings.First());

            var setSubscriptionCommand = new SetSubscriptionCommandStub();

            // Check that current subscription is the default one
            Assert.AreEqual("Windows Azure Sandbox 9-220", setSubscriptionCommand.GetCurrentSubscription().SubscriptionName);

            // Change it and make sure it got changed
            setSubscriptionCommand.SetSubscriptionProcess("DefaultSubscription", null, null, null, null, "TestSubscription1", null, null);
            Assert.AreEqual("TestSubscription1", setSubscriptionCommand.GetCurrentSubscription().SubscriptionName);
            Assert.AreEqual("TestSubscription1", setSubscriptionCommand.GetSubscriptions(null).Values.Single(sub => sub.IsDefault).SubscriptionName);

            // Clean
            globalComponents.DeleteGlobalComponents();
        }