diff --git a/Octopus-Cmdlets.Tests/AddEnvironmentTests.cs b/Octopus-Cmdlets.Tests/AddEnvironmentTests.cs index e8d8bde..d709bff 100644 --- a/Octopus-Cmdlets.Tests/AddEnvironmentTests.cs +++ b/Octopus-Cmdlets.Tests/AddEnvironmentTests.cs @@ -35,7 +35,8 @@ public AddEnvironmentTests() public void With_Name() { // Execute cmdlet - _ps.AddCommand(CmdletName).AddParameter("Name", "Octopus_Dev"); + _ps.AddCommand(CmdletName) + .AddParameter(nameof(AddEnvironment.Name), "Octopus_Dev"); _ps.Invoke(); Assert.Single(_envs); @@ -46,7 +47,8 @@ public void With_Name() public void With_Description() { // Execute cmdlet - _ps.AddCommand(CmdletName).AddParameter("Description", "Octopus Development environment"); + _ps.AddCommand(CmdletName) + .AddParameter(nameof(AddEnvironment.Description), "Octopus Development environment"); Assert.Throws(() => _ps.Invoke()); } @@ -55,8 +57,8 @@ public void With_Name_And_Description() { // Execute cmdlet _ps.AddCommand(CmdletName). - AddParameter("Name", "Octopus_Dev"). - AddParameter("Description", "Octopus Development environment"); + AddParameter(nameof(AddEnvironment.Name), "Octopus_Dev"). + AddParameter(nameof(AddEnvironment.Description), "Octopus Development environment"); _ps.Invoke(); Assert.Single(_envs); diff --git a/Octopus-Cmdlets.Tests/AddLibraryVariableTests.cs b/Octopus-Cmdlets.Tests/AddLibraryVariableTests.cs index 8a6e0af..c81f866 100644 --- a/Octopus-Cmdlets.Tests/AddLibraryVariableTests.cs +++ b/Octopus-Cmdlets.Tests/AddLibraryVariableTests.cs @@ -62,7 +62,9 @@ public void No_Arguments() public void With_Name() { // Execute cmdlet - _ps.AddCommand(CmdletName).AddParameter("VariableSet", "Octopus").AddParameter("Name", "Test"); + _ps.AddCommand(CmdletName) + .AddParameter(nameof(AddLibraryVariable.VariableSet), "Octopus") + .AddParameter(nameof(AddLibraryVariable.Name), "Test"); _ps.Invoke(); Assert.Equal(1, _variableSet.Variables.Count); @@ -73,7 +75,9 @@ public void With_Name() public void With_Invalid_VariableSet() { // Execute cmdlet - _ps.AddCommand(CmdletName).AddParameter("VariableSet", "Gibberish").AddParameter("Name", "Test"); + _ps.AddCommand(CmdletName) + .AddParameter(nameof(AddLibraryVariable.VariableSet), "Gibberish") + .AddParameter(nameof(AddLibraryVariable.Name), "Test"); Assert.Throws(() => _ps.Invoke()); } @@ -82,13 +86,13 @@ public void With_All() { // Execute cmdlet _ps.AddCommand(CmdletName) - .AddParameter("VariableSet", "Octopus") - .AddParameter("Name", "Test") - .AddParameter("Value", "Test Value") - .AddParameter("Environments", new[] { "DEV" }) - .AddParameter("Roles", new[] { "Web" }) - .AddParameter("Machines", new[] { "web-01" }) - .AddParameter("Sensitive", false); + .AddParameter(nameof(AddLibraryVariable.VariableSet), "Octopus") + .AddParameter(nameof(AddLibraryVariable.Name), "Test") + .AddParameter(nameof(AddLibraryVariable.Value), "Test Value") + .AddParameter(nameof(AddLibraryVariable.Environments), new[] { "DEV" }) + .AddParameter(nameof(AddLibraryVariable.Roles), new[] { "Web" }) + .AddParameter(nameof(AddLibraryVariable.Machines), new[] { "web-01" }) + .AddParameter(nameof(AddLibraryVariable.Sensitive), false); _ps.Invoke(); Assert.Equal(1, _variableSet.Variables.Count); @@ -101,8 +105,8 @@ public void With_Object() { // Execute cmdlet _ps.AddCommand(CmdletName) - .AddParameter("VariableSet", "Octopus") - .AddParameter("InputObject", new VariableResource { Name = "Test" }); + .AddParameter(nameof(AddLibraryVariable.VariableSet), "Octopus") + .AddParameter(nameof(AddLibraryVariable.InputObject), new VariableResource { Name = "Test" }); _ps.Invoke(); Assert.Equal(1, _variableSet.Variables.Count);