From e42136e9556703ec1c2a0101abcd586825e50e66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Pluci=C5=84ski?= Date: Mon, 20 Oct 2025 01:19:26 +0200 Subject: [PATCH] upgrade to cake 5.1 and code smells --- Cake.MsDeploy.slnx | 5 + .../Cake.MsDeploy.Tests.csproj | 8 +- .../Unit/Directives/SkipDIrectiveTests.cs | 33 +- .../Unit/MsDeployAliasesTests.cs | 9 +- .../Unit/MsDeployRunnerTests.cs | 501 ++++---- .../Unit/Parameters/DeclareParameterTests.cs | 19 +- .../Unit/Parameters/SetParameterTests.cs | 20 +- .../Unit/Providers/MsDeployProviderTests.cs | 1138 ++++++++--------- .../Unit/Rules/ReplacementRuleTests.cs | 27 +- .../{ExceptionAsserts.cs => AssertEx.cs} | 0 src/Cake.MsDeploy/Cake.MsDeploy.csproj | 2 +- 11 files changed, 865 insertions(+), 897 deletions(-) rename src/Cake.MsDeploy.Tests/Xunit/{ExceptionAsserts.cs => AssertEx.cs} (100%) diff --git a/Cake.MsDeploy.slnx b/Cake.MsDeploy.slnx index 9018ead..891ea03 100644 --- a/Cake.MsDeploy.slnx +++ b/Cake.MsDeploy.slnx @@ -1,4 +1,9 @@ + + + + + diff --git a/src/Cake.MsDeploy.Tests/Cake.MsDeploy.Tests.csproj b/src/Cake.MsDeploy.Tests/Cake.MsDeploy.Tests.csproj index 4b585f5..740e517 100644 --- a/src/Cake.MsDeploy.Tests/Cake.MsDeploy.Tests.csproj +++ b/src/Cake.MsDeploy.Tests/Cake.MsDeploy.Tests.csproj @@ -12,12 +12,12 @@ - - - + + + - + diff --git a/src/Cake.MsDeploy.Tests/Unit/Directives/SkipDIrectiveTests.cs b/src/Cake.MsDeploy.Tests/Unit/Directives/SkipDIrectiveTests.cs index 27793b0..c1c1374 100644 --- a/src/Cake.MsDeploy.Tests/Unit/Directives/SkipDIrectiveTests.cs +++ b/src/Cake.MsDeploy.Tests/Unit/Directives/SkipDIrectiveTests.cs @@ -1,10 +1,10 @@ -using Cake.MsDeploy.Directives; -using System.Collections.Generic; +using System.Collections.Generic; +using Cake.MsDeploy.Directives; using Xunit; namespace Cake.MsDeploy.Tests.Unit.Directives { - public class SkipDirectiveTests + public static class SkipDirectiveTests { public sealed class TheToCommandLineArgument { @@ -15,22 +15,21 @@ public void Should_Throw_If_Context_Is_Null() var rule = new SkipDirective(); // When - var result = Record.Exception(() => rule.AppendCommandLineArgument(null)); + var result = Record.Exception(() => rule.AppendCommandLineArgument(null!)); // Then AssertEx.IsArgumentNullException(result, "sb"); } - [Theory] [MemberData(nameof(SkipDirectiveData))] public void Should_Append_Options(SkipDirective directive, string expected) { - //Given --> When + // Given --> When var actual = directive.ToCommandLineArgument(); - //Then - Assert.Equal(expected, directive.ToCommandLineArgument()); + // Then + Assert.Equal(expected, actual); } public static IEnumerable SkipDirectiveData() @@ -39,33 +38,33 @@ public static IEnumerable SkipDirectiveData() { new object[] { - new SkipDirective { ObjectName = "contentPath", AbsolutePath = "C:\\fake\\path" }, // <------------- Indivdual Property to test + new SkipDirective { ObjectName = "contentPath", AbsolutePath = "C:\\fake\\path" }, // <------------- Indivdual Property to test "-skip:objectName=contentPath,absolutePath=\"C:\\fake\\path\"", // <------------- Expected Result }, new object[] { - new SkipDirective { SkipAction = SkipAction.Update, ObjectName = "windowsAuthentication" }, // <------------- Indivdual Property to test + new SkipDirective { SkipAction = SkipAction.Update, ObjectName = "windowsAuthentication" }, // <------------- Indivdual Property to test "-skip:skipAction=Update,objectName=windowsAuthentication", // <------------- Expected Result }, new object[] { - new SkipDirective { ObjectName = "webConfig", KeyAttribute = "Key attribute"}, // <------------- Indivdual Property to test + new SkipDirective { ObjectName = "webConfig", KeyAttribute = "Key attribute" }, // <------------- Indivdual Property to test "-skip:objectName=webConfig,keyAttribute=\"Key attribute\"", // <------------- Expected Result }, new object[] { - new SkipDirective { ObjectName = "destPath", XPath = "/web.config" }, // <------------- Indivdual Property to test - "-skip:objectName=destPath,xPath=\"/web.config\"", // <------------- Expected Result + new SkipDirective { ObjectName = "destPath", XPath = "/web.config" }, // <------------- Indivdual Property to test + "-skip:objectName=destPath,xPath=\"/web.config\"", // <------------- Expected Result }, - + new object[] { - new SkipDirective { ObjectName = "virtualdirectory", SkipAction = SkipAction.Update, AbsolutePath = "C:\\wwwroot", XPath = "//web.config", KeyAttribute = "Description"}, // <------------- Combined Properties to test - "-skip:skipAction=Update,objectName=virtualdirectory,absolutePath=\"C:\\wwwroot\",xPath=\"//web.config\",keyAttribute=\"Description\"" // <------------- Expected Result - } + new SkipDirective { ObjectName = "virtualdirectory", SkipAction = SkipAction.Update, AbsolutePath = "C:\\wwwroot", XPath = "//web.config", KeyAttribute = "Description" }, // <------------- Combined Properties to test + "-skip:skipAction=Update,objectName=virtualdirectory,absolutePath=\"C:\\wwwroot\",xPath=\"//web.config\",keyAttribute=\"Description\"", // <------------- Expected Result + }, }; } } diff --git a/src/Cake.MsDeploy.Tests/Unit/MsDeployAliasesTests.cs b/src/Cake.MsDeploy.Tests/Unit/MsDeployAliasesTests.cs index 181f3c2..3be1ac9 100644 --- a/src/Cake.MsDeploy.Tests/Unit/MsDeployAliasesTests.cs +++ b/src/Cake.MsDeploy.Tests/Unit/MsDeployAliasesTests.cs @@ -4,7 +4,6 @@ namespace Cake.MsDeploy.Tests.Unit { - public sealed class MsDeployAliasesTests { public sealed class TheMsDeployMethod @@ -16,10 +15,10 @@ public void Should_Throw_If_Context_Is_Null() var context = Substitute.For(); // When - var result = Record.Exception(() => MsDeployAliases.MsDeploy(null, null)); + var result = Record.Exception(() => MsDeployAliases.MsDeploy(null!, null!)); // Then - AssertEx.IsArgumentNullException(result, "context"); + AssertEx.IsArgumentNullException(result, nameof(context)); } [Fact] @@ -29,11 +28,11 @@ public void Should_Throw_If_Settings_Is_Null() var context = Substitute.For(); // When - var result = Record.Exception(() => MsDeployAliases.MsDeploy(context, null)); + var result = Record.Exception(() => MsDeployAliases.MsDeploy(context, null!)); // Then AssertEx.IsArgumentNullException(result, "settings"); - } + } } } } \ No newline at end of file diff --git a/src/Cake.MsDeploy.Tests/Unit/MsDeployRunnerTests.cs b/src/Cake.MsDeploy.Tests/Unit/MsDeployRunnerTests.cs index 83f7fd1..87eff54 100644 --- a/src/Cake.MsDeploy.Tests/Unit/MsDeployRunnerTests.cs +++ b/src/Cake.MsDeploy.Tests/Unit/MsDeployRunnerTests.cs @@ -1,9 +1,9 @@ -using Cake.MsDeploy.Parameters; +using System.Collections.Generic; +using Cake.MsDeploy.Parameters; using Cake.MsDeploy.Providers; using Cake.MsDeploy.Providers.MsDeployProviders; using Cake.MsDeploy.Tests.Fixture; using Cake.Testing; -using System.Collections.Generic; using Xunit; namespace Cake.MsDeploy.Tests.Unit @@ -16,8 +16,10 @@ public sealed class TheDeployMethod public void Should_Throw_If_Settings_Are_Null() { // Given - var fixture = new MsDeployFixture(); - fixture.Settings = null; + var fixture = new MsDeployFixture + { + Settings = null!, + }; fixture.GivenDefaultToolDoNotExist(); // When @@ -72,233 +74,242 @@ public void Should_Add_Mandatory_Arguments() public void Should_Add_Source_Path_And_Content_Providers() { // Given - var fixture = new MsDeployFixture(); - fixture.Settings = new MsDeploySettings + var fixture = new MsDeployFixture { - Verb = Operation.Sync, - RetryAttempts = 5, - RetryInterval = 5000, - Source = new PackageProvider + Settings = new MsDeploySettings { - Direction = MsDeploy.Providers.Direction.source, - Path = "./src/Application.zip" + Verb = Operation.Sync, + RetryAttempts = 5, + RetryInterval = 5000, + Source = new PackageProvider + { + Direction = MsDeploy.Providers.Direction.source, + Path = "./src/Application.zip", + }, + Destination = new AutoProvider + { + Direction = MsDeploy.Providers.Direction.dest, + IncludeAcls = false, + AuthenticationType = MsDeploy.Providers.AuthenticationScheme.NTLM, + ComputerName = "cake.computerName.com", + TempAgent = true, + }, + AllowUntrusted = true, + UseCheckSum = true, + PreSyncCommand = "%windir%\\System32\\inetsrv\\appcmd.exe stop APPPOOL NameOfAppPool", + PostSyncCommand = "%windir%\\System32\\inetsrv\\appcmd.exe start APPPOOL NameOfAppPool", + WhatIf = true, + SetParams = new List + { + new SetParameter + { + Name = "IIS Web Application Name", + Value = "www.cake.com", + }, + }, }, - Destination = new AutoProvider + }; + + // When + var result = fixture.Run(); + + // Then + Assert.Equal("-verb:sync -source:package=\"./src/Application.zip\" -dest:auto,computerName=\"cake.computerName.com\",authtype=NTLM,includeAcls=false,tempAgent=true -setParam:name=\"IIS Web Application Name\",value=\"www.cake.com\" -retryAttempts:5 -retryInterval:5000 -whatif -allowUntrusted -useCheckSum -preSync:runCommand=\"%windir%\\System32\\inetsrv\\appcmd.exe stop APPPOOL NameOfAppPool\" -postSync:runCommand=\"%windir%\\System32\\inetsrv\\appcmd.exe start APPPOOL NameOfAppPool\"", result.Args); + } + + [Fact] + public void Should_Add_Command_Provider_Additional_Settings() + { + // Given + var fixture = new MsDeployFixture + { + Settings = new MsDeploySettings { - Direction = MsDeploy.Providers.Direction.dest, - IncludeAcls = false, - AuthenticationType = MsDeploy.Providers.AuthenticationScheme.NTLM, - ComputerName = "cake.computerName.com", - TempAgent = true + Verb = Operation.Sync, + RetryAttempts = 5, + RetryInterval = 5000, + Source = new PackageProvider + { + Direction = MsDeploy.Providers.Direction.source, + Path = "./src/Application.zip", + }, + Destination = new AutoProvider + { + Direction = MsDeploy.Providers.Direction.dest, + IncludeAcls = false, + AuthenticationType = MsDeploy.Providers.AuthenticationScheme.NTLM, + ComputerName = "cake.computerName.com", + TempAgent = true, + }, + AllowUntrusted = true, + UseCheckSum = true, + PreSyncCommand = new CommandProvider + { + Path = "%windir%\\System32\\inetsrv\\appcmd.exe stop APPPOOL NameOfAppPool", + WaitInterval = 60000, + }, + PostSyncCommand = new CommandProvider + { + Path = "%windir%\\System32\\inetsrv\\appcmd.exe start APPPOOL NameOfAppPool", + WaitInterval = 15000, + }, + WhatIf = true, + SetParams = new List + { + new SetParameter + { + Name = "IIS Web Application Name", + Value = "www.cake.com", + }, + }, }, - AllowUntrusted = true, - UseCheckSum = true, - PreSyncCommand = "%windir%\\System32\\inetsrv\\appcmd.exe stop APPPOOL NameOfAppPool", - PostSyncCommand = "%windir%\\System32\\inetsrv\\appcmd.exe start APPPOOL NameOfAppPool", - WhatIf = true, - SetParams = new List + }; + + // When + var result = fixture.Run(); + + // Then + Assert.Equal("-verb:sync -source:package=\"./src/Application.zip\" -dest:auto,computerName=\"cake.computerName.com\",authtype=NTLM,includeAcls=false,tempAgent=true -setParam:name=\"IIS Web Application Name\",value=\"www.cake.com\" -retryAttempts:5 -retryInterval:5000 -whatif -allowUntrusted -useCheckSum -preSync:runCommand=\"%windir%\\System32\\inetsrv\\appcmd.exe stop APPPOOL NameOfAppPool\",waitInterval=60000 -postSync:runCommand=\"%windir%\\System32\\inetsrv\\appcmd.exe start APPPOOL NameOfAppPool\",waitInterval=15000", result.Args); + } + + [Fact] + public void Should_Add_DisableLinks() + { + // Given + var fixture = new MsDeployFixture + { + Settings = new MsDeploySettings { - new SetParameter + Verb = Operation.Sync, + RetryAttempts = 5, + RetryInterval = 5000, + Source = new PackageProvider { - Name = "IIS Web Application Name", - Value = "www.cake.com" - } - } + Direction = MsDeploy.Providers.Direction.source, + Path = "./src/Application.zip", + }, + Destination = new AutoProvider + { + Direction = MsDeploy.Providers.Direction.dest, + IncludeAcls = false, + AuthenticationType = MsDeploy.Providers.AuthenticationScheme.NTLM, + ComputerName = "cake.computerName.com", + TempAgent = true, + }, + AllowUntrusted = true, + UseCheckSum = true, + WhatIf = true, + SetParams = new List + { + new SetParameter + { + Name = "IIS Web Application Name", + Value = "www.cake.com", + }, + }, + DisableLinks = new string[] { "AppPoolExtension", "ContentExtension", "CertificateExtension" }, + }, }; // When var result = fixture.Run(); // Then - Assert.Equal("-verb:sync -source:package=\"./src/Application.zip\" -dest:auto,computerName=\"cake.computerName.com\",authtype=NTLM,includeAcls=false,tempAgent=true -setParam:name=\"IIS Web Application Name\",value=\"www.cake.com\" -retryAttempts:5 -retryInterval:5000 -whatif -allowUntrusted -useCheckSum -preSync:runCommand=\"%windir%\\System32\\inetsrv\\appcmd.exe stop APPPOOL NameOfAppPool\" -postSync:runCommand=\"%windir%\\System32\\inetsrv\\appcmd.exe start APPPOOL NameOfAppPool\"", result.Args); + Assert.Equal("-verb:sync -source:package=\"./src/Application.zip\" -dest:auto,computerName=\"cake.computerName.com\",authtype=NTLM,includeAcls=false,tempAgent=true -setParam:name=\"IIS Web Application Name\",value=\"www.cake.com\" -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -retryAttempts:5 -retryInterval:5000 -whatif -allowUntrusted -useCheckSum", result.Args); + } + + [Fact] + public void Should_Add_EnableLinks_DisableLinks() + { + // Given + var fixture = new MsDeployFixture + { + Settings = new MsDeploySettings + { + Verb = Operation.Sync, + RetryAttempts = 5, + RetryInterval = 5000, + Source = new PackageProvider + { + Direction = MsDeploy.Providers.Direction.source, + Path = "./src/Application.zip", + }, + Destination = new AutoProvider + { + Direction = MsDeploy.Providers.Direction.dest, + IncludeAcls = false, + AuthenticationType = MsDeploy.Providers.AuthenticationScheme.NTLM, + ComputerName = "cake.computerName.com", + TempAgent = true, + }, + AllowUntrusted = true, + UseCheckSum = true, + WhatIf = true, + SetParams = new List + { + new SetParameter + { + Name = "IIS Web Application Name", + Value = "www.cake.com", + }, + }, + EnableLinks = new string[] { "AppPoolExtension" }, + DisableLinks = new string[] { "ContentExtension", "CertificateExtension" }, + }, + }; + + // When + var result = fixture.Run(); + + // Then + Assert.Equal("-verb:sync -source:package=\"./src/Application.zip\" -dest:auto,computerName=\"cake.computerName.com\",authtype=NTLM,includeAcls=false,tempAgent=true -setParam:name=\"IIS Web Application Name\",value=\"www.cake.com\" -enableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -retryAttempts:5 -retryInterval:5000 -whatif -allowUntrusted -useCheckSum", result.Args); } - [Fact] - public void Should_Add_Command_Provider_Additional_Settings() - { - // Given - var fixture = new MsDeployFixture(); - fixture.Settings = new MsDeploySettings - { - Verb = Operation.Sync, - RetryAttempts = 5, - RetryInterval = 5000, - Source = new PackageProvider - { - Direction = MsDeploy.Providers.Direction.source, - Path = "./src/Application.zip" - }, - Destination = new AutoProvider - { - Direction = MsDeploy.Providers.Direction.dest, - IncludeAcls = false, - AuthenticationType = MsDeploy.Providers.AuthenticationScheme.NTLM, - ComputerName = "cake.computerName.com", - TempAgent = true - }, - AllowUntrusted = true, - UseCheckSum = true, - PreSyncCommand = new CommandProvider - { - Path = "%windir%\\System32\\inetsrv\\appcmd.exe stop APPPOOL NameOfAppPool", - WaitInterval = 60000 - }, - PostSyncCommand = new CommandProvider - { - Path = "%windir%\\System32\\inetsrv\\appcmd.exe start APPPOOL NameOfAppPool", - WaitInterval = 15000 - }, - WhatIf = true, - SetParams = new List - { - new SetParameter - { - Name = "IIS Web Application Name", - Value = "www.cake.com" - } - } - }; - - // When - var result = fixture.Run(); - - // Then - Assert.Equal("-verb:sync -source:package=\"./src/Application.zip\" -dest:auto,computerName=\"cake.computerName.com\",authtype=NTLM,includeAcls=false,tempAgent=true -setParam:name=\"IIS Web Application Name\",value=\"www.cake.com\" -retryAttempts:5 -retryInterval:5000 -whatif -allowUntrusted -useCheckSum -preSync:runCommand=\"%windir%\\System32\\inetsrv\\appcmd.exe stop APPPOOL NameOfAppPool\",waitInterval=60000 -postSync:runCommand=\"%windir%\\System32\\inetsrv\\appcmd.exe start APPPOOL NameOfAppPool\",waitInterval=15000", result.Args); - } - - - [Fact] - public void Should_Add_DisableLinks() - { - // Given - var fixture = new MsDeployFixture(); - fixture.Settings = new MsDeploySettings - { - Verb = Operation.Sync, - RetryAttempts = 5, - RetryInterval = 5000, - Source = new PackageProvider - { - Direction = MsDeploy.Providers.Direction.source, - Path = "./src/Application.zip" - }, - Destination = new AutoProvider - { - Direction = MsDeploy.Providers.Direction.dest, - IncludeAcls = false, - AuthenticationType = MsDeploy.Providers.AuthenticationScheme.NTLM, - ComputerName = "cake.computerName.com", - TempAgent = true - }, - AllowUntrusted = true, - UseCheckSum = true, - WhatIf = true, - SetParams = new List - { - new SetParameter - { - Name = "IIS Web Application Name", - Value = "www.cake.com" - } - }, - DisableLinks = new string[] { "AppPoolExtension", "ContentExtension", "CertificateExtension" }, - }; - - // When - var result = fixture.Run(); - - // Then - Assert.Equal("-verb:sync -source:package=\"./src/Application.zip\" -dest:auto,computerName=\"cake.computerName.com\",authtype=NTLM,includeAcls=false,tempAgent=true -setParam:name=\"IIS Web Application Name\",value=\"www.cake.com\" -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -retryAttempts:5 -retryInterval:5000 -whatif -allowUntrusted -useCheckSum", result.Args); - } - - [Fact] - public void Should_Add_EnableLinks_DisableLinks() - { - // Given - var fixture = new MsDeployFixture(); - fixture.Settings = new MsDeploySettings - { - Verb = Operation.Sync, - RetryAttempts = 5, - RetryInterval = 5000, - Source = new PackageProvider - { - Direction = MsDeploy.Providers.Direction.source, - Path = "./src/Application.zip" - }, - Destination = new AutoProvider - { - Direction = MsDeploy.Providers.Direction.dest, - IncludeAcls = false, - AuthenticationType = MsDeploy.Providers.AuthenticationScheme.NTLM, - ComputerName = "cake.computerName.com", - TempAgent = true - }, - AllowUntrusted = true, - UseCheckSum = true, - WhatIf = true, - SetParams = new List - { - new SetParameter - { - Name = "IIS Web Application Name", - Value = "www.cake.com" - } - }, - EnableLinks = new string[] { "AppPoolExtension" }, - DisableLinks = new string[] { "ContentExtension", "CertificateExtension" }, - }; - - // When - var result = fixture.Run(); - - // Then - Assert.Equal("-verb:sync -source:package=\"./src/Application.zip\" -dest:auto,computerName=\"cake.computerName.com\",authtype=NTLM,includeAcls=false,tempAgent=true -setParam:name=\"IIS Web Application Name\",value=\"www.cake.com\" -enableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -retryAttempts:5 -retryInterval:5000 -whatif -allowUntrusted -useCheckSum", result.Args); - } - - [Fact] - public void Should_Add_EnableLinks() - { - // Given - var fixture = new MsDeployFixture(); - fixture.Settings = new MsDeploySettings - { - Verb = Operation.Sync, - RetryAttempts = 5, - RetryInterval = 5000, - Source = new PackageProvider - { - Direction = MsDeploy.Providers.Direction.source, - Path = "./src/Application.zip" - }, - Destination = new AutoProvider - { - Direction = MsDeploy.Providers.Direction.dest, - IncludeAcls = false, - AuthenticationType = MsDeploy.Providers.AuthenticationScheme.NTLM, - ComputerName = "cake.computerName.com", - TempAgent = true - }, - AllowUntrusted = true, - UseCheckSum = true, - WhatIf = true, - SetParams = new List - { - new SetParameter - { - Name = "IIS Web Application Name", - Value = "www.cake.com" - } - }, - EnableLinks = new string[] { "AppPoolExtension" } - }; - - // When - var result = fixture.Run(); - - // Then - Assert.Equal("-verb:sync -source:package=\"./src/Application.zip\" -dest:auto,computerName=\"cake.computerName.com\",authtype=NTLM,includeAcls=false,tempAgent=true -setParam:name=\"IIS Web Application Name\",value=\"www.cake.com\" -enableLink:AppPoolExtension -retryAttempts:5 -retryInterval:5000 -whatif -allowUntrusted -useCheckSum", result.Args); - } + [Fact] + public void Should_Add_EnableLinks() + { + // Given + var fixture = new MsDeployFixture + { + Settings = new MsDeploySettings + { + Verb = Operation.Sync, + RetryAttempts = 5, + RetryInterval = 5000, + Source = new PackageProvider + { + Direction = MsDeploy.Providers.Direction.source, + Path = "./src/Application.zip", + }, + Destination = new AutoProvider + { + Direction = MsDeploy.Providers.Direction.dest, + IncludeAcls = false, + AuthenticationType = MsDeploy.Providers.AuthenticationScheme.NTLM, + ComputerName = "cake.computerName.com", + TempAgent = true, + }, + AllowUntrusted = true, + UseCheckSum = true, + WhatIf = true, + SetParams = new List + { + new SetParameter + { + Name = "IIS Web Application Name", + Value = "www.cake.com", + }, + }, + EnableLinks = new string[] { "AppPoolExtension" }, + }, + }; + + // When + var result = fixture.Run(); + + // Then + Assert.Equal("-verb:sync -source:package=\"./src/Application.zip\" -dest:auto,computerName=\"cake.computerName.com\",authtype=NTLM,includeAcls=false,tempAgent=true -setParam:name=\"IIS Web Application Name\",value=\"www.cake.com\" -enableLink:AppPoolExtension -retryAttempts:5 -retryInterval:5000 -whatif -allowUntrusted -useCheckSum", result.Args); + } [Theory] [InlineData(new[] { "AppOffline" }, "-verb:sync -source:dirPath=\"./Publish\" -dest:dirPath=\"./Deploy\" -enableRule:AppOffline -whatif")] @@ -306,22 +317,24 @@ public void Should_Add_EnableLinks() public void Should_Add_EnableRules(string[] rules, string expected) { // Given - var fixture = new MsDeployFixture(); - fixture.Settings = new MsDeploySettings + var fixture = new MsDeployFixture { - Verb = Operation.Sync, - Source = new DirPathProvider - { - Direction = Direction.source, - Path = "./Publish" - }, - Destination = new DirPathProvider + Settings = new MsDeploySettings { - Direction = Direction.dest, - Path = "./Deploy" + Verb = Operation.Sync, + Source = new DirPathProvider + { + Direction = Direction.source, + Path = "./Publish", + }, + Destination = new DirPathProvider + { + Direction = Direction.dest, + Path = "./Deploy", + }, + WhatIf = true, + EnableRules = rules, }, - WhatIf = true, - EnableRules = rules }; // When @@ -337,22 +350,24 @@ public void Should_Add_EnableRules(string[] rules, string expected) public void Should_Add_DisableRules(string[] rules, string expected) { // Given - var fixture = new MsDeployFixture(); - fixture.Settings = new MsDeploySettings + var fixture = new MsDeployFixture { - Verb = Operation.Sync, - Source = new DirPathProvider - { - Direction = Direction.source, - Path = "./Publish" - }, - Destination = new DirPathProvider + Settings = new MsDeploySettings { - Direction = Direction.dest, - Path = "./Deploy" + Verb = Operation.Sync, + Source = new DirPathProvider + { + Direction = Direction.source, + Path = "./Publish", + }, + Destination = new DirPathProvider + { + Direction = Direction.dest, + Path = "./Deploy", + }, + WhatIf = true, + DisableRules = rules, }, - WhatIf = true, - DisableRules = rules }; // When @@ -362,5 +377,5 @@ public void Should_Add_DisableRules(string[] rules, string expected) Assert.Equal(expected, result.Args); } } - } + } } diff --git a/src/Cake.MsDeploy.Tests/Unit/Parameters/DeclareParameterTests.cs b/src/Cake.MsDeploy.Tests/Unit/Parameters/DeclareParameterTests.cs index db2f8a2..be0b327 100644 --- a/src/Cake.MsDeploy.Tests/Unit/Parameters/DeclareParameterTests.cs +++ b/src/Cake.MsDeploy.Tests/Unit/Parameters/DeclareParameterTests.cs @@ -1,12 +1,12 @@ -using Cake.MsDeploy.Parameters; -using System; +using System; using System.Collections.Generic; using System.Text; +using Cake.MsDeploy.Parameters; using Xunit; namespace Cake.MsDeploy.Tests.Unit.Parameters { - public class DeclareParameterTests + public static class DeclareParameterTests { public sealed class TheToCommandLineArgument { @@ -17,7 +17,7 @@ public void Should_Throw_If_Context_Is_Null() var declareParameter = new DeclareParameter(); // When - var result = Record.Exception(() => declareParameter.AppendCommandLineArgument(null)); + var result = Record.Exception(() => declareParameter.AppendCommandLineArgument(null!)); // Then AssertEx.IsArgumentNullException(result, "sb"); @@ -36,16 +36,15 @@ public void Should_Throw_If_Name_Is_Null_or_Empty() AssertEx.IsExceptionWithMessage(result, "Name is required when using the DeclareParameter option."); } - [Theory] [MemberData(nameof(DeclareParameterData))] public void Should_Append_Options(DeclareParameter declareParameter, string expected) { - //Given --> When + // Given --> When var actual = declareParameter.ToCommandLineArgument(); - //Then - Assert.Equal(expected, declareParameter.ToCommandLineArgument()); + // Then + Assert.Equal(expected, actual); } public static IEnumerable DeclareParameterData() @@ -54,8 +53,8 @@ public static IEnumerable DeclareParameterData() { new object[] { - new DeclareParameter { Name = "OracleDbUserName", Description = "Oracle Database Username", Kind = ParameterKind.ProviderPath, Scope = "app.config", Match = "12;10;29", DefaultValue = "scott", Tags = new string[] { "Oracle", "DBA" } }, // <------------- Combined Properties to test - "-declareParam:name=\"OracleDbUserName\",kind=\"ProviderPath\",scope=\"app.config\",match=\"12;10;29\",defaultValue=\"scott\",description=\"Oracle Database Username\",tags=\"Oracle,DBA\"" // <------------- Expected Result + new DeclareParameter { Name = "OracleDbUserName", Description = "Oracle Database Username", Kind = ParameterKind.ProviderPath, Scope = "app.config", Match = "12;10;29", DefaultValue = "scott", Tags = new string[] { "Oracle", "DBA" } }, // <------------- Combined Properties to test + "-declareParam:name=\"OracleDbUserName\",kind=\"ProviderPath\",scope=\"app.config\",match=\"12;10;29\",defaultValue=\"scott\",description=\"Oracle Database Username\",tags=\"Oracle,DBA\"", // <------------- Expected Result } }; } diff --git a/src/Cake.MsDeploy.Tests/Unit/Parameters/SetParameterTests.cs b/src/Cake.MsDeploy.Tests/Unit/Parameters/SetParameterTests.cs index ef81a1f..31be02a 100644 --- a/src/Cake.MsDeploy.Tests/Unit/Parameters/SetParameterTests.cs +++ b/src/Cake.MsDeploy.Tests/Unit/Parameters/SetParameterTests.cs @@ -1,12 +1,12 @@ -using Cake.MsDeploy.Parameters; -using System; +using System; using System.Collections.Generic; using System.Text; +using Cake.MsDeploy.Parameters; using Xunit; namespace Cake.MsDeploy.Tests.Unit.Parameters { - public class SetParameterTestsTests + public static class SetParameterTests { public sealed class TheToCommandLineArgument { @@ -17,7 +17,7 @@ public void Should_Throw_If_Context_Is_Null() var declareParameter = new DeclareParameter(); // When - var result = Record.Exception(() => declareParameter.AppendCommandLineArgument(null)); + var result = Record.Exception(() => declareParameter.AppendCommandLineArgument(null!)); // Then AssertEx.IsArgumentNullException(result, "sb"); @@ -40,11 +40,11 @@ public void Should_Throw_If_Name_Is_Null_or_Empty() [MemberData(nameof(SetParameterData))] public void Should_Append_Options(SetParameter setParameter, string expected) { - //Given --> When + // Given --> When var actual = setParameter.ToCommandLineArgument(); - //Then - Assert.Equal(expected, setParameter.ToCommandLineArgument()); + // Then + Assert.Equal(expected, actual); } public static IEnumerable SetParameterData() @@ -53,9 +53,9 @@ public static IEnumerable SetParameterData() { new object[] { - new SetParameter { Name = "OracleDbPassword", Description = "Oracle Database Password", Kind = ParameterKind.ProviderPath, Scope = "app.config", Match = "12;10;29", Value = "tiger" }, // <------------- Combined Properties to test - "-setParam:name=\"OracleDbPassword\",kind=\"ProviderPath\",scope=\"app.config\",match=\"12;10;29\",value=\"tiger\",description=\"Oracle Database Password\"" // <------------- Expected Result - } + new SetParameter { Name = "OracleDbPassword", Description = "Oracle Database Password", Kind = ParameterKind.ProviderPath, Scope = "app.config", Match = "12;10;29", Value = "tiger" }, // <------------- Combined Properties to test + "-setParam:name=\"OracleDbPassword\",kind=\"ProviderPath\",scope=\"app.config\",match=\"12;10;29\",value=\"tiger\",description=\"Oracle Database Password\"", // <------------- Expected Result + }, }; } } diff --git a/src/Cake.MsDeploy.Tests/Unit/Providers/MsDeployProviderTests.cs b/src/Cake.MsDeploy.Tests/Unit/Providers/MsDeployProviderTests.cs index 8abd368..69b789e 100644 --- a/src/Cake.MsDeploy.Tests/Unit/Providers/MsDeployProviderTests.cs +++ b/src/Cake.MsDeploy.Tests/Unit/Providers/MsDeployProviderTests.cs @@ -1,7 +1,7 @@ -using Cake.MsDeploy.Providers; +using System.Collections.Generic; +using Cake.MsDeploy.Providers; using Cake.MsDeploy.Providers.MsDeployProviders; using Cake.MsDeploy.Tests.Fixture; -using System.Collections.Generic; using Xunit; namespace Cake.MsDeploy.Tests.Unit.Providers @@ -17,7 +17,7 @@ public void Should_Throw_If_Context_Is_Null() var obj = new MsDeployProviderFixture(); // When - var result = Record.Exception(() => obj.AppendCommandLineArgument(null)); + var result = Record.Exception(() => obj.AppendCommandLineArgument(null!)); // Then AssertEx.IsArgumentNullException(result, "sb"); @@ -27,668 +27,620 @@ public void Should_Throw_If_Context_Is_Null() [MemberData(nameof(MsDeployProviderData))] public void Should_Append_Options(MsDeployProvider msdeployProvider, string expected) { - //Given --> When + // Given --> When var actual = msdeployProvider.ToCommandLineArgument(); - //Then - Assert.Equal(expected, msdeployProvider.ToCommandLineArgument(), ignoreCase: true); + // Then + Assert.Equal(expected, actual, ignoreCase: true); } +#pragma warning disable MA0051 public static IEnumerable MsDeployProviderData() +#pragma warning restore MA0051 { return new List { - //Source + // Source new object[] { - new MsDeployProviderFixture { - Path = @"d:\web\wwwroot", - AppendQuotesToPath = true, - Direction = Direction.source - - }, // <------------- Indivdual Property to test - "-source:msdeploy-fixture=\"d:\\web\\wwwroot\"" // <------------- Expected Result - + Path = @"d:\web\wwwroot", + AppendQuotesToPath = true, + Direction = Direction.source, + }, // <------------- Indivdual Property to test + "-source:msdeploy-fixture=\"d:\\web\\wwwroot\"", // <------------- Expected Result }, - //Destination + + // Destination new object[] { new MsDeployProviderFixture { - AppendQuotesToPath = true, - AuthenticationType = AuthenticationScheme.NTLM, - ComputerName = "mycomputer.name.ext", - Direction = Direction.dest, - IncludeAcls = false, - Password = "tiger", - Username = "scott", - Path = "src/Application", - TempAgent = true - - }, // <------------- Indivdual Property to test - "-dest:msdeploy-fixture=\"src/Application\",computerName=\"mycomputer.name.ext\",authtype=NTLM,userName=scott,password=tiger,includeAcls=false,tempAgent=true" // <------------- Expected Result + AppendQuotesToPath = true, + AuthenticationType = AuthenticationScheme.NTLM, + ComputerName = "mycomputer.name.ext", + Direction = Direction.dest, + IncludeAcls = false, + Password = "tiger", + Username = "scott", + Path = "src/Application", + TempAgent = true, + }, // <------------- Indivdual Property to test + "-dest:msdeploy-fixture=\"src/Application\",computerName=\"mycomputer.name.ext\",authtype=NTLM,userName=scott,password=tiger,includeAcls=false,tempAgent=true", // <------------- Expected Result }, - //Publish Settings + + // Publish Settings new object[] { new MsDeployProviderFixture { - Path = "siteName", - AppendQuotesToPath = false, - Direction = Direction.dest, - PublishSettings = "d:\\dev.PublishSettings" - - }, // <------------- Indivdual Property to test - "-dest:msdeploy-fixture=siteName,publishSettings=\"d:\\dev.PublishSettings\"" // <------------- Expected Result + Path = "siteName", + AppendQuotesToPath = false, + Direction = Direction.dest, + PublishSettings = "d:\\dev.PublishSettings", + }, // <------------- Indivdual Property to test + "-dest:msdeploy-fixture=siteName,publishSettings=\"d:\\dev.PublishSettings\"", // <------------- Expected Result }, new object[] { new AppHostAuthOverrideProvider { - AppendQuotesToPath = true, - AuthenticationType = AuthenticationScheme.NTLM, - ComputerName = "mycomputer.name.ext", - Direction = Direction.dest, - IncludeAcls = false, - Password = "tiger", - Username = "scott", - Path = "src/Application", - TempAgent = true, - NetFxVersion = "" - - }, // <------------- Indivdual Property to test - "-dest:appHostAuthOverride=\"src/Application\",computerName=\"mycomputer.name.ext\",authtype=NTLM,userName=scott,password=tiger,includeAcls=false,tempAgent=true" // <------------- Expected Result + AppendQuotesToPath = true, + AuthenticationType = AuthenticationScheme.NTLM, + ComputerName = "mycomputer.name.ext", + Direction = Direction.dest, + IncludeAcls = false, + Password = "tiger", + Username = "scott", + Path = "src/Application", + TempAgent = true, + NetFxVersion = string.Empty, + }, // <------------- Indivdual Property to test + "-dest:appHostAuthOverride=\"src/Application\",computerName=\"mycomputer.name.ext\",authtype=NTLM,userName=scott,password=tiger,includeAcls=false,tempAgent=true", // <------------- Expected Result }, + new object[] + { + new AppHostAuthOverrideProvider + { + Direction = Direction.dest, + NetFxVersion = "RJ5NK4JAIG", + }, + "-dest:appHostAuthOverride=,netFxVersion=\"RJ5NK4JAIG\"", + }, - new object[] - { - new AppHostAuthOverrideProvider - { - Direction = Direction.dest, - NetFxVersion = "RJ5NK4JAIG", - - }, - "-dest:appHostAuthOverride=,netFxVersion=\"RJ5NK4JAIG\"" - }, - - new object[] - { - new AppHostConfigProvider - { - Direction = Direction.dest, - AppOfflineTemplate = "UFCD7K6J2B", - WebConfigEncryptProvider = "0OVC809HFC", - - }, - "-dest:appHostConfig=,appOfflineTemplate=\"UFCD7K6J2B\",webConfigEncryptProvider=\"0OVC809HFC\"" - }, - - new object[] - { - new AppHostSchemaProvider - { - Direction = Direction.dest, - - }, - "-dest:appHostSchema=" - }, - - new object[] - { - new AppPoolConfigProvider - { - Direction = Direction.dest, - - }, - "-dest:appPoolConfig=" - }, - - new object[] - { - new AppPoolEnable32BitProvider - { - Direction = Direction.dest, - Enable32Bit = false, - - }, - "-dest:appPoolEnable32Bit=,enable32Bit=false" - }, - - new object[] - { - new AppPoolNetFxProvider - { - Direction = Direction.dest, - NetFxVersion = "4ENCQSPGJT", - - }, - "-dest:appPoolNetFx=,netFxVersion=\"4ENCQSPGJT\"" - }, - - new object[] - { - new AppPoolPipelineProvider - { - Direction = Direction.dest, - PipelineMode = null, - - }, - "-dest:appPoolPipeline=" - }, - - new object[] - { - new ArchiveDirProvider - { - Direction = Direction.dest, - - }, - "-dest:archiveDir=" - }, - - new object[] - { - new AutoProvider - { - Direction = Direction.dest, - - }, - "-dest:auto" - }, - - new object[] - { - new BackupManagerProvider - { - Direction = Direction.dest, - ConnectionString = "FGGIK1RUUF", - UseLatest = false, - - }, - "-dest:backupManager=,connectionString=\"FGGIK1RUUF\",useLatest=false" - }, - - new object[] - { - new BackupSettingsProvider - { - Direction = Direction.dest, - Enabled = false, - NumberOfBackups = 10, - ContinueSyncOnBackupFailure = false, - AddExcludedProviders = new string[] { "430YVDY3PT", "ASDFASDFASDFA" }, - - }, - "-dest:backupSettings=,enabled=false,numberOfBackups=10,continueSyncOnBackupFailure=false,addExcludedProviders=430YVDY3PT;ASDFASDFASDFA" - }, - - new object[] - { - new CertProvider - { - Direction = Direction.dest, - - }, - "-dest:cert=" - }, - - new object[] - { - new CertStoreSettingsProvider - { - Direction = Direction.dest, - - }, - "-dest:certStoreSettings=" - }, - - new object[] - { - new ComObject32Provider - { - Direction = Direction.dest, + new object[] + { + new AppHostConfigProvider + { + Direction = Direction.dest, + AppOfflineTemplate = "UFCD7K6J2B", + WebConfigEncryptProvider = "0OVC809HFC", + }, + "-dest:appHostConfig=,appOfflineTemplate=\"UFCD7K6J2B\",webConfigEncryptProvider=\"0OVC809HFC\"", + }, - }, - "-dest:comObject32=" - }, + new object[] + { + new AppHostSchemaProvider + { + Direction = Direction.dest, + }, + "-dest:appHostSchema=", + }, - new object[] - { - new ComObject64Provider - { - Direction = Direction.dest, + new object[] + { + new AppPoolConfigProvider + { + Direction = Direction.dest, + }, + "-dest:appPoolConfig=", + }, - }, - "-dest:comObject64=" - }, + new object[] + { + new AppPoolEnable32BitProvider + { + Direction = Direction.dest, + Enable32Bit = false, + }, + "-dest:appPoolEnable32Bit=,enable32Bit=false", + }, - new object[] - { - new ContentPathAspNetCoreProvider - { - Direction = Direction.dest, + new object[] + { + new AppPoolNetFxProvider + { + Direction = Direction.dest, + NetFxVersion = "4ENCQSPGJT", + }, + "-dest:appPoolNetFx=,netFxVersion=\"4ENCQSPGJT\"", + }, - }, - "-dest:contentPathAspNetCore=" - }, + new object[] + { + new AppPoolPipelineProvider + { + Direction = Direction.dest, + PipelineMode = null, + }, + "-dest:appPoolPipeline=", + }, - new object[] - { - new ContentPathLibProvider - { - Direction = Direction.dest, - SyncPackageTimeStamps = false, + new object[] + { + new ArchiveDirProvider + { + Direction = Direction.dest, + }, + "-dest:archiveDir=", + }, - }, - "-dest:contentPathLib=,syncPackageTimeStamps=false" - }, + new object[] + { + new AutoProvider + { + Direction = Direction.dest, + }, + "-dest:auto", + }, - new object[] - { - new ContentPathProvider - { - Direction = Direction.dest, - AppOfflineTemplate = "5C4FLQ1AXO", - WebConfigEncryptProvider = "509J5THN1G", - SyncPackageTimeStamps = false, - - }, - "-dest:contentPath=,appOfflineTemplate=\"5C4FLQ1AXO\",webConfigEncryptProvider=\"509J5THN1G\",syncPackageTimeStamps=false" - }, - - new object[] - { - new CreateAppProvider - { - Direction = Direction.dest, - ManagedRuntimeVersion = "JPWAIBOYQM", - Enable32BitAppOnWin64 = false, - ManagedPipelineMode = null, - - }, - "-dest:createApp=,managedRuntimeVersion=\"JPWAIBOYQM\",enable32BitAppOnWin64=false" - }, - - new object[] - { - new DbDacFxProvider - { - Direction = Direction.dest, - DropDestinationDatabase = false, - DacpacAction = DacpacAction.Script, - IncludeData = false, - CommandTimeout = 10, - AllowDropBlockingAssemblies = false, - AllowIncompatiblePlatform = false, - BackupDatabaseBeforeChanges = false, - BlockOnPossibleDataLoss = false, - BlockWhenDriftDetected = false, - CommentOutSetVarDeclarations = false, - CompareUsingTargetCollation = false, - CreateNewDatabase = false, - DeployDatabaseInSingleUserMode = false, - DisableAndReenableDdlTriggers = false, - DoNotAlterChangeDataCaptureObjects = false, - DoNotAlterReplicatedObjects = false, - DropConstraintsNotInSource = false, - DropDmlTriggersNotInSource = false, - DropExtendedPropertiesNotInSource = false, - DropIndexesNotInSource = false, - DropObjectsNotInSource = false, - DropPermissionsNotInSource = false, - DropRoleMembersNotInSource = false, - DropStatisticsNotInSource = false, - GenerateSmartDefaults = false, - IgnoreAnsiNulls = false, - IgnoreAuthorizer = false, - IgnoreColumnCollation = false, - IgnoreComments = false, - IgnoreCryptographicProviderFilePath = false, - IgnoreDdlTriggerOrder = false, - IgnoreDdlTriggerState = false, - IgnoreDefaultSchema = false, - IgnoreDmlTriggerOrder = false, - IgnoreDmlTriggerState = false, - IgnoreExtendedProperties = false, - IgnoreFileAndLogFilePath = false, - IgnoreFilegroupPlacement = false, - IgnoreFileSize = false, - IgnoreFillFactor = false, - IgnoreFullTextCatalogFilePath = false, - IgnoreIdentitySeed = false, - IgnoreIncrement = false, - IgnoreIndexOptions = false, - IgnoreIndexPadding = false, - IgnoreKeywordCasing = false, - IgnoreLockHintsOnIndexes = false, - IgnoreLoginSids = false, - IgnoreNotForReplication = false, - IgnoreObjectPlacementOnPartitionScheme = false, - IgnorePartitionSchemes = false, - IgnorePermissions = false, - IgnoreQuotedIdentifiers = false, - IgnoreRoleMembership = false, - IgnoreRouteLifetime = false, - IgnoreSemicolonBetweenStatements = false, - IgnoreTableOptions = false, - IgnoreUserSettingsObjects = false, - IgnoreWhitespace = false, - IgnoreWithNocheckOnCheckConstraints = false, - IgnoreWithNocheckOnForeignKeys = false, - IncludeCompositeObjects = false, - IncludeTransactionalScripts = false, - NoAlterStatementsToChangeClrTypes = false, - PopulateFilesOnFileGroups = false, - RegisterDataTierApplication = false, - RunDeploymentPlanExecutors = false, - ScriptDatabaseCollation = false, - ScriptDatabaseCompatibility = false, - ScriptDatabaseOptions = false, - ScriptDeployStateChecks = false, - ScriptFileSize = false, - ScriptNewConstraintValidation = false, - ScriptRefreshModule = false, - TreatVerificationErrorsAsWarnings = false, - UnmodifiableObjectWarnings = false, - VerifyCollationCompatibility = false, - VerifyDeployment = false, - - }, - "-dest:dbDacFx=,dropDestinationDatabase=false,dacpacAction=Script,includeData=false,commandTimeout=10,allowDropBlockingAssemblies=false,allowIncompatiblePlatform=false,backupDatabaseBeforeChanges=false,blockOnPossibleDataLoss=false,blockWhenDriftDetected=false,commentOutSetVarDeclarations=false,compareUsingTargetCollation=false,createNewDatabase=false,deployDatabaseInSingleUserMode=false,disableAndReenableDdlTriggers=false,doNotAlterChangeDataCaptureObjects=false,doNotAlterReplicatedObjects=false,dropConstraintsNotInSource=false,dropDmlTriggersNotInSource=false,dropExtendedPropertiesNotInSource=false,dropIndexesNotInSource=false,dropObjectsNotInSource=false,dropPermissionsNotInSource=false,dropRoleMembersNotInSource=false,dropStatisticsNotInSource=false,generateSmartDefaults=false,ignoreAnsiNulls=false,ignoreAuthorizer=false,ignoreColumnCollation=false,ignoreComments=false,ignoreCryptographicProviderFilePath=false,ignoreDdlTriggerOrder=false,ignoreDdlTriggerState=false,ignoreDefaultSchema=false,ignoreDmlTriggerOrder=false,ignoreDmlTriggerState=false,ignoreExtendedProperties=false,ignoreFileAndLogFilePath=false,ignoreFilegroupPlacement=false,ignoreFileSize=false,ignoreFillFactor=false,ignoreFullTextCatalogFilePath=false,ignoreIdentitySeed=false,ignoreIncrement=false,ignoreIndexOptions=false,ignoreIndexPadding=false,ignoreKeywordCasing=false,ignoreLockHintsOnIndexes=false,ignoreLoginSids=false,ignoreNotForReplication=false,ignoreObjectPlacementOnPartitionScheme=false,ignorePartitionSchemes=false,ignorePermissions=false,ignoreQuotedIdentifiers=false,ignoreRoleMembership=false,ignoreRouteLifetime=false,ignoreSemicolonBetweenStatements=false,ignoreTableOptions=false,ignoreUserSettingsObjects=false,ignoreWhitespace=false,ignoreWithNocheckOnCheckConstraints=false,ignoreWithNocheckOnForeignKeys=false,includeCompositeObjects=false,includeTransactionalScripts=false,noAlterStatementsToChangeClrTypes=false,populateFilesOnFileGroups=false,registerDataTierApplication=false,runDeploymentPlanExecutors=false,scriptDatabaseCollation=false,scriptDatabaseCompatibility=false,scriptDatabaseOptions=false,scriptDeployStateChecks=false,scriptFileSize=false,scriptNewConstraintValidation=false,scriptRefreshModule=false,treatVerificationErrorsAsWarnings=false,unmodifiableObjectWarnings=false,verifyCollationCompatibility=false,verifyDeployment=false" - }, - - new object[] - { - new DbFullSqlProvider - { - Direction = Direction.dest, - DropDestinationDatabase = false, - ForceScriptDatabase = false, - ScriptDropsFirst = false, - Transacted = false, - SqlCe = false, - SkipSqlCmdParsing = false, - ObjectList = "4V0ZYDMA64", - CreateDBConnectionString = "9Q6GJD3Q3B", - CommandDelimiter = "5KCIKPP47J", - RemoveCommandDelimiter = false, - StoreConnectionStringPassword = false, - CommandTimeout = 10, - - }, - "-dest:dbFullSql=,dropDestinationDatabase=false,forceScriptDatabase=false,scriptDropsFirst=false,transacted=false,sqlCe=false,skipSqlCmdParsing=false,objectList=\"4V0ZYDMA64\",createDBConnectionString=\"9Q6GJD3Q3B\",commandDelimiter=\"5KCIKPP47J\",removeCommandDelimiter=false,storeConnectionStringPassword=false,commandTimeout=10" - }, - - new object[] - { - new DbMySqlProvider - { - Direction = Direction.dest, - CreateDBConnectionString = "CDUKTK9KV1", - IncludeData = false, - Transacted = false, - CommandDelimiter = "HGQ6G2SQ0E", - RemoveCommandDelimiter = false, - WaitAttempts = 10, - WaitInterval = 10, - CommandTimeout = 10, - IncludeSchema = false, - - }, - "-dest:dbMySql=,createDBConnectionString=\"CDUKTK9KV1\",includeData=false,transacted=false,commandDelimiter=\"HGQ6G2SQ0E\",removeCommandDelimiter=false,waitAttempts=10,waitInterval=10,commandTimeout=10,includeSchema=false" - }, - - new object[] - { - new DbSqliteProvider - { - Direction = Direction.dest, - CreateDBConnectionString = "I75OQTSSPI", - IncludeData = false, - Transacted = false, - CommandDelimiter = "YRDX266WW9", - RemoveCommandDelimiter = false, - WaitAttempts = 10, - WaitInterval = 10, - CommandTimeout = 10, - - }, - "-dest:dbSqlite=,createDBConnectionString=\"I75OQTSSPI\",includeData=false,transacted=false,commandDelimiter=\"YRDX266WW9\",removeCommandDelimiter=false,waitAttempts=10,waitInterval=10,commandTimeout=10" - }, - - new object[] - { - new DirPathProvider - { - Direction = Direction.dest, - IgnoreErrors = "DT5B4Z4GBR", - FirstChangeUSN = 10, - Incremental = false, - - }, - "-dest:dirPath=,ignoreErrors=\"DT5B4Z4GBR\",firstChangeUSN=10,incremental=false" - }, - - new object[] - { - new FilePathProvider - { - Direction = Direction.dest, - IgnoreErrors = "79D2BEHF49", + new object[] + { + new BackupManagerProvider + { + Direction = Direction.dest, + ConnectionString = "FGGIK1RUUF", + UseLatest = false, + }, + "-dest:backupManager=,connectionString=\"FGGIK1RUUF\",useLatest=false", + }, - }, - "-dest:filePath=,ignoreErrors=\"79D2BEHF49\"" - }, + new object[] + { + new BackupSettingsProvider + { + Direction = Direction.dest, + Enabled = false, + NumberOfBackups = 10, + ContinueSyncOnBackupFailure = false, + AddExcludedProviders = new string[] { "430YVDY3PT", "ASDFASDFASDFA" }, + }, + "-dest:backupSettings=,enabled=false,numberOfBackups=10,continueSyncOnBackupFailure=false,addExcludedProviders=430YVDY3PT;ASDFASDFASDFA", + }, - new object[] - { - new GacAssemblyProvider - { - Direction = Direction.dest, + new object[] + { + new CertProvider + { + Direction = Direction.dest, + }, + "-dest:cert=", + }, - }, - "-dest:gacAssembly=" - }, + new object[] + { + new CertStoreSettingsProvider + { + Direction = Direction.dest, + }, + "-dest:certStoreSettings=", + }, - new object[] - { - new GacInstallProvider - { - Direction = Direction.dest, + new object[] + { + new ComObject32Provider + { + Direction = Direction.dest, + }, + "-dest:comObject32=", + }, - }, - "-dest:gacInstall=" - }, + new object[] + { + new ComObject64Provider + { + Direction = Direction.dest, + }, + "-dest:comObject64=", + }, - new object[] - { - new IisAppProvider - { - Direction = Direction.dest, - SkipAppCreation = false, - ManagedRuntimeVersion = "1R4MDZD2DK", - Enable32BitAppOnWin64 = false, - ManagedPipelineMode = "6631AZB4U1", - AppOfflineTemplate = "YLQ7LYOLVX", - WebConfigEncryptProvider = "Y01WHWYS7E", - SyncPackageTimeStamps = "VBD1VAFM2M", - - }, - "-dest:iisApp=,skipAppCreation=false,managedRuntimeVersion=\"1R4MDZD2DK\",enable32BitAppOnWin64=false,managedPipelineMode=\"6631AZB4U1\",appOfflineTemplate=\"YLQ7LYOLVX\",webConfigEncryptProvider=\"Y01WHWYS7E\",syncPackageTimeStamps=\"VBD1VAFM2M\"" - }, - - new object[] - { - new MachineConfig32Provider - { - Direction = Direction.dest, - NetFxVersion = "DNVDKPA7BO", + new object[] + { + new ContentPathAspNetCoreProvider + { + Direction = Direction.dest, + }, + "-dest:contentPathAspNetCore=", + }, - }, - "-dest:machineConfig32=,netFxVersion=\"DNVDKPA7BO\"" - }, + new object[] + { + new ContentPathLibProvider + { + Direction = Direction.dest, + SyncPackageTimeStamps = false, + }, + "-dest:contentPathLib=,syncPackageTimeStamps=false", + }, - new object[] - { - new MachineConfig64Provider - { - Direction = Direction.dest, - NetFxVersion = "L2GPVFEGTO", + new object[] + { + new ContentPathProvider + { + Direction = Direction.dest, + AppOfflineTemplate = "5C4FLQ1AXO", + WebConfigEncryptProvider = "509J5THN1G", + SyncPackageTimeStamps = false, + }, + "-dest:contentPath=,appOfflineTemplate=\"5C4FLQ1AXO\",webConfigEncryptProvider=\"509J5THN1G\",syncPackageTimeStamps=false", + }, - }, - "-dest:machineConfig64=,netFxVersion=\"L2GPVFEGTO\"" - }, + new object[] + { + new CreateAppProvider + { + Direction = Direction.dest, + ManagedRuntimeVersion = "JPWAIBOYQM", + Enable32BitAppOnWin64 = false, + ManagedPipelineMode = null, + }, + "-dest:createApp=,managedRuntimeVersion=\"JPWAIBOYQM\",enable32BitAppOnWin64=false", + }, - new object[] - { - new ManifestProvider - { - Direction = Direction.dest, - SkipInvalid = false, + new object[] + { + new DbDacFxProvider + { + Direction = Direction.dest, + DropDestinationDatabase = false, + DacpacAction = DacpacAction.Script, + IncludeData = false, + CommandTimeout = 10, + AllowDropBlockingAssemblies = false, + AllowIncompatiblePlatform = false, + BackupDatabaseBeforeChanges = false, + BlockOnPossibleDataLoss = false, + BlockWhenDriftDetected = false, + CommentOutSetVarDeclarations = false, + CompareUsingTargetCollation = false, + CreateNewDatabase = false, + DeployDatabaseInSingleUserMode = false, + DisableAndReenableDdlTriggers = false, + DoNotAlterChangeDataCaptureObjects = false, + DoNotAlterReplicatedObjects = false, + DropConstraintsNotInSource = false, + DropDmlTriggersNotInSource = false, + DropExtendedPropertiesNotInSource = false, + DropIndexesNotInSource = false, + DropObjectsNotInSource = false, + DropPermissionsNotInSource = false, + DropRoleMembersNotInSource = false, + DropStatisticsNotInSource = false, + GenerateSmartDefaults = false, + IgnoreAnsiNulls = false, + IgnoreAuthorizer = false, + IgnoreColumnCollation = false, + IgnoreComments = false, + IgnoreCryptographicProviderFilePath = false, + IgnoreDdlTriggerOrder = false, + IgnoreDdlTriggerState = false, + IgnoreDefaultSchema = false, + IgnoreDmlTriggerOrder = false, + IgnoreDmlTriggerState = false, + IgnoreExtendedProperties = false, + IgnoreFileAndLogFilePath = false, + IgnoreFilegroupPlacement = false, + IgnoreFileSize = false, + IgnoreFillFactor = false, + IgnoreFullTextCatalogFilePath = false, + IgnoreIdentitySeed = false, + IgnoreIncrement = false, + IgnoreIndexOptions = false, + IgnoreIndexPadding = false, + IgnoreKeywordCasing = false, + IgnoreLockHintsOnIndexes = false, + IgnoreLoginSids = false, + IgnoreNotForReplication = false, + IgnoreObjectPlacementOnPartitionScheme = false, + IgnorePartitionSchemes = false, + IgnorePermissions = false, + IgnoreQuotedIdentifiers = false, + IgnoreRoleMembership = false, + IgnoreRouteLifetime = false, + IgnoreSemicolonBetweenStatements = false, + IgnoreTableOptions = false, + IgnoreUserSettingsObjects = false, + IgnoreWhitespace = false, + IgnoreWithNocheckOnCheckConstraints = false, + IgnoreWithNocheckOnForeignKeys = false, + IncludeCompositeObjects = false, + IncludeTransactionalScripts = false, + NoAlterStatementsToChangeClrTypes = false, + PopulateFilesOnFileGroups = false, + RegisterDataTierApplication = false, + RunDeploymentPlanExecutors = false, + ScriptDatabaseCollation = false, + ScriptDatabaseCompatibility = false, + ScriptDatabaseOptions = false, + ScriptDeployStateChecks = false, + ScriptFileSize = false, + ScriptNewConstraintValidation = false, + ScriptRefreshModule = false, + TreatVerificationErrorsAsWarnings = false, + UnmodifiableObjectWarnings = false, + VerifyCollationCompatibility = false, + VerifyDeployment = false, + }, + "-dest:dbDacFx=,dropDestinationDatabase=false,dacpacAction=Script,includeData=false,commandTimeout=10,allowDropBlockingAssemblies=false,allowIncompatiblePlatform=false,backupDatabaseBeforeChanges=false,blockOnPossibleDataLoss=false,blockWhenDriftDetected=false,commentOutSetVarDeclarations=false,compareUsingTargetCollation=false,createNewDatabase=false,deployDatabaseInSingleUserMode=false,disableAndReenableDdlTriggers=false,doNotAlterChangeDataCaptureObjects=false,doNotAlterReplicatedObjects=false,dropConstraintsNotInSource=false,dropDmlTriggersNotInSource=false,dropExtendedPropertiesNotInSource=false,dropIndexesNotInSource=false,dropObjectsNotInSource=false,dropPermissionsNotInSource=false,dropRoleMembersNotInSource=false,dropStatisticsNotInSource=false,generateSmartDefaults=false,ignoreAnsiNulls=false,ignoreAuthorizer=false,ignoreColumnCollation=false,ignoreComments=false,ignoreCryptographicProviderFilePath=false,ignoreDdlTriggerOrder=false,ignoreDdlTriggerState=false,ignoreDefaultSchema=false,ignoreDmlTriggerOrder=false,ignoreDmlTriggerState=false,ignoreExtendedProperties=false,ignoreFileAndLogFilePath=false,ignoreFilegroupPlacement=false,ignoreFileSize=false,ignoreFillFactor=false,ignoreFullTextCatalogFilePath=false,ignoreIdentitySeed=false,ignoreIncrement=false,ignoreIndexOptions=false,ignoreIndexPadding=false,ignoreKeywordCasing=false,ignoreLockHintsOnIndexes=false,ignoreLoginSids=false,ignoreNotForReplication=false,ignoreObjectPlacementOnPartitionScheme=false,ignorePartitionSchemes=false,ignorePermissions=false,ignoreQuotedIdentifiers=false,ignoreRoleMembership=false,ignoreRouteLifetime=false,ignoreSemicolonBetweenStatements=false,ignoreTableOptions=false,ignoreUserSettingsObjects=false,ignoreWhitespace=false,ignoreWithNocheckOnCheckConstraints=false,ignoreWithNocheckOnForeignKeys=false,includeCompositeObjects=false,includeTransactionalScripts=false,noAlterStatementsToChangeClrTypes=false,populateFilesOnFileGroups=false,registerDataTierApplication=false,runDeploymentPlanExecutors=false,scriptDatabaseCollation=false,scriptDatabaseCompatibility=false,scriptDatabaseOptions=false,scriptDeployStateChecks=false,scriptFileSize=false,scriptNewConstraintValidation=false,scriptRefreshModule=false,treatVerificationErrorsAsWarnings=false,unmodifiableObjectWarnings=false,verifyCollationCompatibility=false,verifyDeployment=false", + }, - }, - "-dest:manifest=,skipInvalid=false" - }, + new object[] + { + new DbFullSqlProvider + { + Direction = Direction.dest, + DropDestinationDatabase = false, + ForceScriptDatabase = false, + ScriptDropsFirst = false, + Transacted = false, + SqlCe = false, + SkipSqlCmdParsing = false, + ObjectList = "4V0ZYDMA64", + CreateDBConnectionString = "9Q6GJD3Q3B", + CommandDelimiter = "5KCIKPP47J", + RemoveCommandDelimiter = false, + StoreConnectionStringPassword = false, + CommandTimeout = 10, + }, + "-dest:dbFullSql=,dropDestinationDatabase=false,forceScriptDatabase=false,scriptDropsFirst=false,transacted=false,sqlCe=false,skipSqlCmdParsing=false,objectList=\"4V0ZYDMA64\",createDBConnectionString=\"9Q6GJD3Q3B\",commandDelimiter=\"5KCIKPP47J\",removeCommandDelimiter=false,storeConnectionStringPassword=false,commandTimeout=10", + }, - new object[] - { - new MetaKeyProvider - { - Direction = Direction.dest, - MetadataGetInherited = false, - UseRealAbo = false, + new object[] + { + new DbMySqlProvider + { + Direction = Direction.dest, + CreateDBConnectionString = "CDUKTK9KV1", + IncludeData = false, + Transacted = false, + CommandDelimiter = "HGQ6G2SQ0E", + RemoveCommandDelimiter = false, + WaitAttempts = 10, + WaitInterval = 10, + CommandTimeout = 10, + IncludeSchema = false, + }, + "-dest:dbMySql=,createDBConnectionString=\"CDUKTK9KV1\",includeData=false,transacted=false,commandDelimiter=\"HGQ6G2SQ0E\",removeCommandDelimiter=false,waitAttempts=10,waitInterval=10,commandTimeout=10,includeSchema=false", + }, - }, - "-dest:metaKey=,metadataGetInherited=false,useRealAbo=false" - }, + new object[] + { + new DbSqliteProvider + { + Direction = Direction.dest, + CreateDBConnectionString = "I75OQTSSPI", + IncludeData = false, + Transacted = false, + CommandDelimiter = "YRDX266WW9", + RemoveCommandDelimiter = false, + WaitAttempts = 10, + WaitInterval = 10, + CommandTimeout = 10, + }, + "-dest:dbSqlite=,createDBConnectionString=\"I75OQTSSPI\",includeData=false,transacted=false,commandDelimiter=\"YRDX266WW9\",removeCommandDelimiter=false,waitAttempts=10,waitInterval=10,commandTimeout=10", + }, - new object[] - { - new PackageProvider - { - Direction = Direction.dest, + new object[] + { + new DirPathProvider + { + Direction = Direction.dest, + IgnoreErrors = "DT5B4Z4GBR", + FirstChangeUSN = 10, + Incremental = false, + }, + "-dest:dirPath=,ignoreErrors=\"DT5B4Z4GBR\",firstChangeUSN=10,incremental=false", + }, - }, - "-dest:package=" - }, + new object[] + { + new FilePathProvider + { + Direction = Direction.dest, + IgnoreErrors = "79D2BEHF49", + }, + "-dest:filePath=,ignoreErrors=\"79D2BEHF49\"", + }, - new object[] - { - new RecycleAppProvider - { - Direction = Direction.dest, - RecycleMode = null, - Timeout = 10, + new object[] + { + new GacAssemblyProvider + { + Direction = Direction.dest, + }, + "-dest:gacAssembly=", + }, - }, - "-dest:recycleApp=,timeout=10" - }, + new object[] + { + new GacInstallProvider + { + Direction = Direction.dest, + }, + "-dest:gacInstall=", + }, - new object[] - { - new RegKeyProvider - { - Direction = Direction.dest, + new object[] + { + new IisAppProvider + { + Direction = Direction.dest, + SkipAppCreation = false, + ManagedRuntimeVersion = "1R4MDZD2DK", + Enable32BitAppOnWin64 = false, + ManagedPipelineMode = "6631AZB4U1", + AppOfflineTemplate = "YLQ7LYOLVX", + WebConfigEncryptProvider = "Y01WHWYS7E", + SyncPackageTimeStamps = "VBD1VAFM2M", + }, + "-dest:iisApp=,skipAppCreation=false,managedRuntimeVersion=\"1R4MDZD2DK\",enable32BitAppOnWin64=false,managedPipelineMode=\"6631AZB4U1\",appOfflineTemplate=\"YLQ7LYOLVX\",webConfigEncryptProvider=\"Y01WHWYS7E\",syncPackageTimeStamps=\"VBD1VAFM2M\"", + }, - }, - "-dest:regKey=" - }, + new object[] + { + new MachineConfig32Provider + { + Direction = Direction.dest, + NetFxVersion = "DNVDKPA7BO", + }, + "-dest:machineConfig32=,netFxVersion=\"DNVDKPA7BO\"", + }, - new object[] - { - new RegValueProvider - { - Direction = Direction.dest, + new object[] + { + new MachineConfig64Provider + { + Direction = Direction.dest, + NetFxVersion = "L2GPVFEGTO", + }, + "-dest:machineConfig64=,netFxVersion=\"L2GPVFEGTO\"", + }, - }, - "-dest:regValue=" - }, + new object[] + { + new ManifestProvider + { + Direction = Direction.dest, + SkipInvalid = false, + }, + "-dest:manifest=,skipInvalid=false", + }, - new object[] - { - new RootWebConfig32Provider - { - Direction = Direction.dest, - NetFxVersion = "AS6PFWIZMK", + new object[] + { + new MetaKeyProvider + { + Direction = Direction.dest, + MetadataGetInherited = false, + UseRealAbo = false, + }, + "-dest:metaKey=,metadataGetInherited=false,useRealAbo=false", + }, - }, - "-dest:rootWebConfig32=,netFxVersion=\"AS6PFWIZMK\"" - }, + new object[] + { + new PackageProvider + { + Direction = Direction.dest, + }, + "-dest:package=", + }, - new object[] - { - new RootWebConfig64Provider - { - Direction = Direction.dest, - NetFxVersion = "SCSJULFYM1", + new object[] + { + new RecycleAppProvider + { + Direction = Direction.dest, + RecycleMode = null, + Timeout = 10, + }, + "-dest:recycleApp=,timeout=10", + }, - }, - "-dest:rootWebConfig64=,netFxVersion=\"SCSJULFYM1\"" - }, + new object[] + { + new RegKeyProvider + { + Direction = Direction.dest, + }, + "-dest:regKey=", + }, - new object[] - { - new RunCommandProvider - { - Direction = Direction.dest, - DontUseCommandExe = false, - DontUseJobObject = false, - WaitAttempts = 10, - WaitInterval = 10, - SuccessReturnCodes = "V1RS335XGQ", - - }, - "-dest:runCommand=,dontUseCommandExe=false,dontUseJobObject=false,waitAttempts=10,waitInterval=10,successReturnCodes=\"V1RS335XGQ\"" - }, - - new object[] - { - new SetAclProvider - { - Direction = Direction.dest, - SetAclUser = "692NLURF7X", - SetAclAccess = "GLU05IJ74J", - SetAclResourceType = null, - - }, - "-dest:setAcl=,setAclUser=\"692NLURF7X\",setAclAccess=\"GLU05IJ74J\"" - }, - - new object[] - { - new UrlScanConfigProvider - { - Direction = Direction.dest, + new object[] + { + new RegValueProvider + { + Direction = Direction.dest, + }, + "-dest:regValue=", + }, - }, - "-dest:urlScanConfig=" - }, + new object[] + { + new RootWebConfig32Provider + { + Direction = Direction.dest, + NetFxVersion = "AS6PFWIZMK", + }, + "-dest:rootWebConfig32=,netFxVersion=\"AS6PFWIZMK\"", + }, - new object[] - { - new WebServer60Provider - { - Direction = Direction.dest, + new object[] + { + new RootWebConfig64Provider + { + Direction = Direction.dest, + NetFxVersion = "SCSJULFYM1", + }, + "-dest:rootWebConfig64=,netFxVersion=\"SCSJULFYM1\"" + }, - }, - "-dest:webServer60=" - }, + new object[] + { + new RunCommandProvider + { + Direction = Direction.dest, + DontUseCommandExe = false, + DontUseJobObject = false, + WaitAttempts = 10, + WaitInterval = 10, + SuccessReturnCodes = "V1RS335XGQ", + }, + "-dest:runCommand=,dontUseCommandExe=false,dontUseJobObject=false,waitAttempts=10,waitInterval=10,successReturnCodes=\"V1RS335XGQ\"" + }, - new object[] - { - new WebServerProvider - { - Direction = Direction.dest, + new object[] + { + new SetAclProvider + { + Direction = Direction.dest, + SetAclUser = "692NLURF7X", + SetAclAccess = "GLU05IJ74J", + SetAclResourceType = null, + }, + "-dest:setAcl=,setAclUser=\"692NLURF7X\",setAclAccess=\"GLU05IJ74J\"", + }, - }, - "-dest:webServer=" - } + new object[] + { + new UrlScanConfigProvider + { + Direction = Direction.dest, + }, + "-dest:urlScanConfig=", + }, + new object[] + { + new WebServer60Provider + { + Direction = Direction.dest, + }, + "-dest:webServer60=", + }, + new object[] + { + new WebServerProvider + { + Direction = Direction.dest, + }, + "-dest:webServer=", + } }; } } diff --git a/src/Cake.MsDeploy.Tests/Unit/Rules/ReplacementRuleTests.cs b/src/Cake.MsDeploy.Tests/Unit/Rules/ReplacementRuleTests.cs index 547f7d2..8e6b6f9 100644 --- a/src/Cake.MsDeploy.Tests/Unit/Rules/ReplacementRuleTests.cs +++ b/src/Cake.MsDeploy.Tests/Unit/Rules/ReplacementRuleTests.cs @@ -17,7 +17,7 @@ public void Should_Throw_If_Context_Is_Null() var rule = new ReplacementRule(); // When - var result = Record.Exception(() => rule.AppendCommandLineArgument(null)); + var result = Record.Exception(() => rule.AppendCommandLineArgument(null!)); // Then AssertEx.IsArgumentNullException(result, "sb"); @@ -31,7 +31,6 @@ public void Should_Throw_If_ObjectName_Is_Null_Or_Empty() var sb = new StringBuilder(); // When --> Then - Assert.Throws(() => { rule.AppendCommandLineArgument(sb); }); } @@ -39,11 +38,11 @@ public void Should_Throw_If_ObjectName_Is_Null_Or_Empty() [MemberData(nameof(ReplacementRuleData))] public void Should_Append_Options(ReplacementRule rule, string expected) { - //Given --> When + // Given --> When var actual = rule.ToCommandLineArgument(); - //Then - Assert.Equal(expected, rule.ToCommandLineArgument()); + // Then + Assert.Equal(expected, actual); } public static IEnumerable ReplacementRuleData() @@ -52,26 +51,26 @@ public static IEnumerable ReplacementRuleData() { new object[] { - new ReplacementRule { ObjectName = "binding", ScopeAttributeName = "Image" }, // <------------- Indivdual Property to test + new ReplacementRule { ObjectName = "binding", ScopeAttributeName = "Image" }, // <------------- Indivdual Property to test "-replace:objectName=binding,scopeAttributeName=\"Image\"", // <------------- Expected Result }, new object[] { - new ReplacementRule { ObjectName = "binding", ScopeAttributeValue = "jpg" }, // <------------- Indivdual Property to test + new ReplacementRule { ObjectName = "binding", ScopeAttributeValue = "jpg" }, // <------------- Indivdual Property to test "-replace:objectName=binding,scopeAttributeValue=\"jpg\"", // <------------- Expected Result }, new object[] { - new ReplacementRule { ObjectName = "binding", TargetAttributeName = "png" }, // <------------- Indivdual Property to test + new ReplacementRule { ObjectName = "binding", TargetAttributeName = "png" }, // <------------- Indivdual Property to test "-replace:objectName=binding,targetAttributeName=\"png\"", // <------------- Expected Result }, new object[] { - new ReplacementRule { ObjectName = "binding", Match = "true" }, // <------------- Indivdual Property to test - "-replace:objectName=binding,match=\"true\"", // <------------- Expected Result + new ReplacementRule { ObjectName = "binding", Match = "true" }, // <------------- Indivdual Property to test + "-replace:objectName=binding,match=\"true\"", // <------------- Expected Result }, new object[] @@ -82,11 +81,11 @@ public static IEnumerable ReplacementRuleData() new object[] { - new ReplacementRule { ObjectName = "virtualdirectory", ScopeAttributeName = "physicalPath", ScopeAttributeValue = "Image", TargetAttributeName ="allowSubDirConfig", Match = "true", Value = "false" }, // <------------- Combined Properties to test - "-replace:objectName=virtualdirectory,scopeAttributeName=\"physicalPath\",scopeAttributeValue=\"Image\",targetAttributeName=\"allowSubDirConfig\",match=\"true\",replace=\"false\"" // <------------- Expected Result - } + new ReplacementRule { ObjectName = "virtualdirectory", ScopeAttributeName = "physicalPath", ScopeAttributeValue = "Image", TargetAttributeName = "allowSubDirConfig", Match = "true", Value = "false" }, // <------------- Combined Properties to test + "-replace:objectName=virtualdirectory,scopeAttributeName=\"physicalPath\",scopeAttributeValue=\"Image\",targetAttributeName=\"allowSubDirConfig\",match=\"true\",replace=\"false\"", // <------------- Expected Result + }, }; } - } + } } } diff --git a/src/Cake.MsDeploy.Tests/Xunit/ExceptionAsserts.cs b/src/Cake.MsDeploy.Tests/Xunit/AssertEx.cs similarity index 100% rename from src/Cake.MsDeploy.Tests/Xunit/ExceptionAsserts.cs rename to src/Cake.MsDeploy.Tests/Xunit/AssertEx.cs diff --git a/src/Cake.MsDeploy/Cake.MsDeploy.csproj b/src/Cake.MsDeploy/Cake.MsDeploy.csproj index e5b5489..6b7a2f9 100644 --- a/src/Cake.MsDeploy/Cake.MsDeploy.csproj +++ b/src/Cake.MsDeploy/Cake.MsDeploy.csproj @@ -36,7 +36,7 @@ https://github.com/cake-contrib/Cake.MsDeploy.git - +