public void SetAzureServiceProjectTestsLocationValid() { string[] locations = { "West US", "East US", "East Asia", "North Europe" }; foreach (string item in locations) { using (FileSystemHelper files = new FileSystemHelper(this)) { // Create new empty settings file // PowerShellProjectPathInfo paths = new PowerShellProjectPathInfo(files.RootPath); ServiceSettings settings = new ServiceSettings(); mockCommandRuntime = new MockCommandRuntime(); setServiceProjectCmdlet.CommandRuntime = mockCommandRuntime; settings.Save(paths.Settings); settings = setServiceProjectCmdlet.SetAzureServiceProjectProcess(item, null, null, paths.Settings); // Assert location is changed // Assert.AreEqual<string>(item, settings.Location); ServiceSettings actualOutput = mockCommandRuntime.OutputPipeline[0] as ServiceSettings; Assert.AreEqual<string>(item, settings.Location); } } }
public void SetAzureServiceProjectTestsLocationInvalidFail() { 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); Testing.AssertThrows<ArgumentException>(() => new SetAzureServiceProjectCommand().SetAzureServiceProjectProcess("MyHome", null, null, null, paths.Settings), string.Format(Resources.InvalidServiceSettingElement, "Location")); } }
public void SetAzureServiceProjectTestsLocationEmptyFail() { 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); Testing.AssertThrows<ArgumentException>(() => setServiceProjectCmdlet.SetAzureServiceProjectProcess(string.Empty, null, null, paths.Settings), string.Format(Resources.InvalidOrEmptyArgumentMessage, "Location")); } }
public void SetAzureServiceProjectTestsSubscriptionEmptyFail() { 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); Testing.AssertThrows <ArgumentException>(() => setServiceProjectCmdlet.SetAzureServiceProjectProcess( null, null, null, string.Empty, paths.Settings), string.Format(Resources.InvalidOrEmptyArgumentMessage, "Subscription")); } }
public void SetAzureServiceProjectTestsUnknownLocation() { 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); string unknownLocation = "Unknown Location"; settings = setServiceProjectCmdlet.SetAzureServiceProjectProcess(unknownLocation, null, null, paths.Settings); // Assert location is changed // Assert.Equal <string>(unknownLocation, settings.Location); ServiceSettings actualOutput = mockCommandRuntime.OutputPipeline[0] as ServiceSettings; Assert.Equal <string>(unknownLocation, settings.Location); } }
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); } } }
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 SetAzureServiceProjectTestsStorageTests() { using (FileSystemHelper files = new FileSystemHelper(this)) { // Create new empty settings file // PowerShellProjectPathInfo paths = new PowerShellProjectPathInfo(files.RootPath); ServiceSettings settings = new ServiceSettings(); mockCommandRuntime = new MockCommandRuntime(); setServiceProjectCmdlet.CommandRuntime = mockCommandRuntime; settings.Save(paths.Settings); settings = setServiceProjectCmdlet.SetAzureServiceProjectProcess(null, null, "companystore", paths.Settings); // Assert storageAccountName is changed // Assert.Equal <string>("companystore", settings.StorageServiceName); ServiceSettings actualOutput = mockCommandRuntime.OutputPipeline[0] as ServiceSettings; Assert.Equal <string>("companystore", settings.StorageServiceName); } }
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); } } }
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); } } }
public void SetAzureServiceProjectTestsSubscriptionValid() { 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); setServiceProjectCmdlet.PassThru = false; settings = setServiceProjectCmdlet.SetAzureServiceProjectProcess(null, null, null, item, paths.Settings); // Assert subscription is changed // Assert.AreEqual<string>(item, settings.Subscription); Assert.AreEqual<int>(0, mockCommandRuntime.OutputPipeline.Count); } } }
public void SetAzureServiceProjectTestsSubscriptionValid() { 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); setServiceProjectCmdlet.PassThru = false; settings = setServiceProjectCmdlet.SetAzureServiceProjectProcess(null, null, null, item, paths.Settings); // Assert subscription is changed // Assert.AreEqual <string>(item, settings.Subscription); Assert.AreEqual <int>(0, mockCommandRuntime.OutputPipeline.Count); } } }
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); } } }
public void SetConfig(string configUniqueId) { if (!this.disposed) { var cfgMan = new FanControlConfigManager(ConfigsDirectory); if (!cfgMan.Contains(configUniqueId)) { throw new ArgumentException("The specified config does not exist."); } else { ServiceSettings.Default.SelectedConfigId = configUniqueId; ServiceSettings.Save(); if (this.fanControl != null) { this.fanControl.Dispose(); this.fanControl = null; } } } }
public void SetAzureServiceProjectTestsLocationValid() { foreach (KeyValuePair<LocationName, string> item in ArgumentConstants.Locations) { using (FileSystemHelper files = new FileSystemHelper(this)) { // Create new empty settings file // ServicePathInfo paths = new ServicePathInfo(files.RootPath); ServiceSettings settings = new ServiceSettings(); mockCommandRuntime = new MockCommandRuntime(); setServiceProjectCmdlet.CommandRuntime = mockCommandRuntime; settings.Save(paths.Settings); settings = setServiceProjectCmdlet.SetAzureServiceProjectProcess(item.Value, null, null, null, paths.Settings); // Assert location is changed // Assert.AreEqual<string>(item.Value, settings.Location); ServiceSettings actualOutput = mockCommandRuntime.OutputPipeline[0] as ServiceSettings; Assert.AreEqual<string>(item.Value, settings.Location); } } }
public ServiceSettings 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.StorageServiceName = newStorage; } if (newSubscription != null) { settings.Subscription = newSubscription; } if (newLocation != null || newSlot != null || newStorage != null || newSubscription != null) { settings.Save(settingsPath); } if (PassThru) { WriteObject(settings); } return(settings); }
public void SetAzureServiceProjectTestsStorageTests() { using (FileSystemHelper files = new FileSystemHelper(this)) { // Create new empty settings file // ServicePathInfo paths = new ServicePathInfo(files.RootPath); ServiceSettings settings = new ServiceSettings(); writer = new FakeWriter(); cmdlet.Writer = writer; settings.Save(paths.Settings); settings = cmdlet.SetAzureServiceProjectProcess(null, null, "companystore", null, paths.Settings); // Assert storageAccountName is changed // Assert.AreEqual<string>("companystore", settings.StorageAccountName); ServiceSettings actualOutput = writer.OutputChannel[0] as ServiceSettings; Assert.AreEqual<string>("companystore", settings.StorageAccountName); } }
public void SetAzureServiceProjectTestsUnknownLocation() { 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); string unknownLocation = "Unknown Location"; settings = setServiceProjectCmdlet.SetAzureServiceProjectProcess(unknownLocation, null, null, paths.Settings); // Assert location is changed // Assert.AreEqual<string>(unknownLocation, settings.Location); ServiceSettings actualOutput = mockCommandRuntime.OutputPipeline[0] as ServiceSettings; Assert.AreEqual<string>(unknownLocation, settings.Location); } }
public void SetAzureServiceProjectTestsSubscriptionValid() { foreach (string item in Data.ValidSubscriptionNames) { using (FileSystemHelper files = new FileSystemHelper(this)) { // Create new empty settings file // ServicePathInfo paths = new ServicePathInfo(files.RootPath); ServiceSettings settings = new ServiceSettings(); writer = new FakeWriter(); cmdlet.Writer = writer; settings.Save(paths.Settings); settings = cmdlet.SetAzureServiceProjectProcess(null, null, null, item, paths.Settings); // Assert subscription is changed // Assert.AreEqual<string>(item, settings.Subscription); ServiceSettings actualOutput = writer.OutputChannel[0] as ServiceSettings; Assert.AreEqual<string>(item, actualOutput.Subscription); } } }
public void SetAzureServiceProjectTestsSubscriptionEmptyFail() { 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); Testing.AssertThrows<ArgumentException>(() => new SetAzureServiceProjectCommand().SetAzureServiceProjectProcess(null, null, null, string.Empty, paths.Settings), string.Format(Resources.InvalidOrEmptyArgumentMessage, "Subscription")); } }
public void SetAzureServiceProjectTestsStorageTests() { 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(null, null, "companystore", null, paths.Settings); // Assert storageAccountName is changed // settings = ServiceSettings.Load(paths.Settings); Assert.AreEqual<string>("companystore", settings.StorageAccountName); } }
public void SetAzureServiceProjectTestsSlotTestsInvalidFail() { 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); Testing.AssertThrows<ArgumentException>(() => setServiceProjectCmdlet.SetAzureServiceProjectProcess(null, "MyHome", null, paths.Settings), string.Format(Resources.InvalidServiceSettingElement, "Slot")); } }
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.AreEqual<string>(item, settings.Slot); } } }
public void SetAzureServiceProjectTestsStorageTests() { using (FileSystemHelper files = new FileSystemHelper(this)) { // Create new empty settings file // PowerShellProjectPathInfo paths = new PowerShellProjectPathInfo(files.RootPath); ServiceSettings settings = new ServiceSettings(); mockCommandRuntime = new MockCommandRuntime(); setServiceProjectCmdlet.CommandRuntime = mockCommandRuntime; settings.Save(paths.Settings); settings = setServiceProjectCmdlet.SetAzureServiceProjectProcess(null, null, "companystore", paths.Settings); // Assert storageAccountName is changed // Assert.AreEqual<string>("companystore", settings.StorageServiceName); ServiceSettings actualOutput = mockCommandRuntime.OutputPipeline[0] as ServiceSettings; Assert.AreEqual<string>("companystore", settings.StorageServiceName); } }
public void SetAzureServiceProjectTestsSlotTests() { foreach (KeyValuePair<SlotType, string> item in 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); setServiceProjectCmdlet.SetAzureServiceProjectProcess(null, item.Value, null, null, paths.Settings); // Assert slot is changed // settings = ServiceSettings.Load(paths.Settings); Assert.AreEqual<string>(item.Value, settings.Slot); } } }
public void SetAzureServiceProjectTestsSubscriptionValid() { 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 SetAzureServiceProjectCommand().SetAzureServiceProjectProcess(null, null, null, item, paths.Settings); // Assert subscription is changed // settings = ServiceSettings.Load(paths.Settings); Assert.AreEqual<string>(item, settings.Subscription); } } }