예제 #1
0
        public void SetAzureDeploymentStorageProcess(string newStorage, string settingsPath)
        {
            ServiceSettings settings = ServiceSettings.Load(settingsPath);

            settings.StorageAccountName = newStorage;
            settings.Save(settingsPath);
        }
        public void SetAzureDeploymentLocationProcess(string newLocation, string settingsPath)
        {
            ServiceSettings settings = ServiceSettings.Load(settingsPath);

            settings.Location = newLocation;
            settings.Save(settingsPath);
        }
예제 #3
0
        public void SetAzureDeploymentSlotProcess(string newSlot, string settingsPath)
        {
            ServiceSettings settings = ServiceSettings.Load(settingsPath);

            settings.Slot = newSlot;
            settings.Save(settingsPath);
        }
예제 #4
0
        public void SetAzureServiceProjectProcess(string newLocation, string newSlot, string newStorage, string newSubscription, string settingsPath)
        {
            ServiceSettings settings = ServiceSettings.Load(settingsPath);

            if (newLocation != null)
            {
                settings.Location = newLocation;
            }

            if (newSlot != null)
            {
                settings.Slot = newSlot;
            }

            if (newStorage != null)
            {
                settings.StorageAccountName = newStorage;
            }

            if (newSubscription != null)
            {
                settings.Subscription = newSubscription;
            }

            if (newLocation != null || newSlot != null || newStorage != null || newSubscription != null)
            {
                settings.Save(settingsPath);
            }
        }
        public ServiceSettings SetAzureServiceProjectProcess(string newLocation, string newSlot, string newStorage, string settingsPath)
        {
            ServiceSettings settings = ServiceSettings.Load(settingsPath);

            if (newLocation != null)
            {
                settings.Location = newLocation;
            }

            if (newSlot != null)
            {
                settings.Slot = newSlot;
            }

            if (newStorage != null)
            {
                settings.StorageServiceName = newStorage;
            }

            if (newLocation != null || newSlot != null || newStorage != null)
            {
                settings.Save(settingsPath);
            }

            if (PassThru)
            {
                WriteObject(settings);
            }

            return(settings);
        }
        public void AzureSetDeploymentStorageAccountNameProcessTests()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                // Create new empty settings file
                //
                ServicePathInfo paths    = new ServicePathInfo(files.RootPath);
                ServiceSettings settings = new ServiceSettings();
                settings.Save(paths.Settings);

                new SetAzureDeploymentStorageCommand().SetAzureDeploymentStorageProcess("companystore", paths.Settings);

                // Assert storageAccountName is changed
                //
                settings = ServiceSettings.Load(paths.Settings);
                Assert.AreEqual <string>("companystore", settings.StorageAccountName);
            }
        }
        public void AzureSetDeploymentSlotProcessTests()
        {
            foreach (KeyValuePair <Slot, string> item in AzureDeploymentCmdlets.Model.ArgumentConstants.Slots)
            {
                using (FileSystemHelper files = new FileSystemHelper(this))
                {
                    // Create new empty settings file
                    //
                    ServicePathInfo paths    = new ServicePathInfo(files.RootPath);
                    ServiceSettings settings = new ServiceSettings();
                    settings.Save(paths.Settings);

                    new SetAzureDeploymentSlotCommand().SetAzureDeploymentSlotProcess(item.Value, paths.Settings);

                    // Assert slot is changed
                    //
                    settings = ServiceSettings.Load(paths.Settings);
                    Assert.AreEqual <string>(item.Value, settings.Slot);
                }
            }
        }
        public void AzureSetDeploymentSubscriptionProcessTests()
        {
            foreach (string item in Data.ValidSubscriptionName)
            {
                using (FileSystemHelper files = new FileSystemHelper(this))
                {
                    // Create new empty settings file
                    //
                    ServicePathInfo paths    = new ServicePathInfo(files.RootPath);
                    ServiceSettings settings = new ServiceSettings();
                    settings.Save(paths.Settings);

                    new SetAzureDeploymentSubscriptionCommand().SetAzureDeploymentSubscriptionProcess(item, paths.Settings);

                    // Assert subscription is changed
                    //
                    settings = ServiceSettings.Load(paths.Settings);
                    Assert.AreEqual <string>(item, settings.Subscription);
                }
            }
        }
예제 #9
0
        public void SetAzureServiceProjectTestsLocationValid()
        {
            foreach (KeyValuePair <Location, string> item in Microsoft.WindowsAzure.Management.CloudService.Model.ArgumentConstants.Locations)
            {
                using (FileSystemHelper files = new FileSystemHelper(this))
                {
                    // Create new empty settings file
                    //
                    ServicePathInfo paths    = new ServicePathInfo(files.RootPath);
                    ServiceSettings settings = new ServiceSettings();
                    settings.Save(paths.Settings);

                    new SetAzureServiceProjectCommand().SetAzureServiceProjectProcess(item.Value, null, null, null, paths.Settings);

                    // Assert location is changed
                    //
                    settings = ServiceSettings.Load(paths.Settings);
                    Assert.AreEqual <string>(item.Value, settings.Location);
                }
            }
        }
예제 #10
0
        public void SetAzureServiceProjectTestsSlotTests()
        {
            string[] slots = { DeploymentSlotType.Production, DeploymentSlotType.Staging };
            foreach (string item in slots)
            {
                using (FileSystemHelper files = new FileSystemHelper(this))
                {
                    // Create new empty settings file
                    //
                    PowerShellProjectPathInfo paths    = new PowerShellProjectPathInfo(files.RootPath);
                    ServiceSettings           settings = new ServiceSettings();
                    settings.Save(paths.Settings);

                    setServiceProjectCmdlet.SetAzureServiceProjectProcess(null, item, null, paths.Settings);

                    // Assert slot is changed
                    //
                    settings = ServiceSettings.Load(paths.Settings);
                    Assert.Equal <string>(item, settings.Slot);
                }
            }
        }