public void ThrowsForPublicEnvironment() { Mock<ICommandRuntime> commandRuntimeMock = new Mock<ICommandRuntime>(); foreach (string name in WindowsAzureEnvironment.PublicEnvironments.Keys) { RemoveAzureEnvironmentCommand cmdlet = new RemoveAzureEnvironmentCommand() { CommandRuntime = commandRuntimeMock.Object, Name = name }; Testing.AssertThrows<InvalidOperationException>( () => cmdlet.ExecuteCmdlet(), string.Format(Resources.ChangePublicEnvironmentMessage, name)); } }
public void RemovesAzureEnvironment() { Mock<ICommandRuntime> commandRuntimeMock = new Mock<ICommandRuntime>(); string name = "test"; GlobalSettingsManager.Instance.AddEnvironment(name, "test url"); RemoveAzureEnvironmentCommand cmdlet = new RemoveAzureEnvironmentCommand() { CommandRuntime = commandRuntimeMock.Object, Name = name }; cmdlet.ExecuteCmdlet(); Testing.AssertThrows<KeyNotFoundException>( () => GlobalSettingsManager.Instance.GetEnvironment(name), string.Format(Resources.EnvironmentNotFound, name)); }
public void ThrowsForUnknownEnvironment() { Mock<ICommandRuntime> commandRuntimeMock = new Mock<ICommandRuntime>(); RemoveAzureEnvironmentCommand cmdlet = new RemoveAzureEnvironmentCommand() { CommandRuntime = commandRuntimeMock.Object, Name = "test2" }; Testing.AssertThrows<KeyNotFoundException>( () => cmdlet.ExecuteCmdlet(), string.Format(Resources.EnvironmentNotFound, "test2")); }