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 // ServicePathInfo paths = new ServicePathInfo(files.RootPath); ServiceSettings settings = new ServiceSettings(); mockCommandRuntime = new MockCommandRuntime(); setServiceProjectCmdlet.CommandRuntime = mockCommandRuntime; settings.Save(paths.Settings); settings = setServiceProjectCmdlet.SetAzureServiceProjectProcess(item, null, 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 SetAzureServiceProjectTestsLocationEmptyFail() { 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(string.Empty, null, null, null, paths.Settings), string.Format(Resources.InvalidOrEmptyArgumentMessage, "Location")); } }
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 void SetAzureServiceProjectTestsSlotTests() { string[] slots = { DeploymentSlotType.Production, DeploymentSlotType.Staging }; foreach (string item in 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, null, null, paths.Settings); // Assert slot is changed // settings = ServiceSettings.Load(paths.Settings); Assert.AreEqual<string>(item, settings.Slot); } } }
public void SetAzureServiceProjectTestsUnknownLocation() { 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); string unknownLocation = "Unknown Location"; settings = setServiceProjectCmdlet.SetAzureServiceProjectProcess(unknownLocation, null, 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.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 SetAzureServiceProjectTestsStorageTests() { 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(null, null, "companystore", null, 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 SetAzureServiceProjectTestsSlotTestsInvalidFail() { 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, "MyHome", null, null, paths.Settings), string.Format(Resources.InvalidServiceSettingElement, "Slot")); } }
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); } } }