summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWouterTinus <wouter.tinus@gmail.com>2019-02-25 21:36:16 +0100
committerWouterTinus <wouter.tinus@gmail.com>2019-02-25 21:36:16 +0100
commit618aed2620d24b8a11bb05ab88d69f7289cdb3df (patch)
tree918cfe3f9f3f93a06ac04e80aa3ea2915b121f5d
parentc05f97b00cb92768c66672d5b80abc475a132ce7 (diff)
downloadletsencrypt-win-simple-origin/2.0.2.zip
letsencrypt-win-simple-origin/2.0.2.tar.gz
letsencrypt-win-simple-origin/2.0.2.tar.bz2
add tests for named parametersorigin/2.0.2
-rw-r--r--src/main.test/Tests/InstallationPluginTests/ScriptPluginTests.cs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main.test/Tests/InstallationPluginTests/ScriptPluginTests.cs b/src/main.test/Tests/InstallationPluginTests/ScriptPluginTests.cs
index 65f0ae1..c42c595 100644
--- a/src/main.test/Tests/InstallationPluginTests/ScriptPluginTests.cs
+++ b/src/main.test/Tests/InstallationPluginTests/ScriptPluginTests.cs
@@ -17,6 +17,7 @@ namespace PKISharp.WACS.UnitTests.Tests.InstallationPluginTests
private readonly ICertificateService cs;
private readonly FileInfo batchPath;
private readonly FileInfo psPath;
+ private readonly FileInfo psNamedPath;
public ScriptPluginTests()
{
@@ -38,6 +39,14 @@ namespace PKISharp.WACS.UnitTests.Tests.InstallationPluginTests
$"Write-Host \"Hello $arg\""
);
+ psNamedPath = new FileInfo(tempPath.FullName + "\\createnamed.ps1");
+ File.WriteAllText(psNamedPath.FullName,
+ $"param([Parameter(Mandatory)][string]$What)\n" +
+ $"if ($What -ne \"world\") {{ Write-Error \"Wrong\" }} else {{\n" +
+ $"Write-Host \"Hello $arg\" + " +
+ $"}}"
+ );
+
}
private void TestScript(string script, string parameters)
@@ -96,5 +105,22 @@ namespace PKISharp.WACS.UnitTests.Tests.InstallationPluginTests
Assert.IsTrue(log.ErrorMessages.Count == 1);
}
+ [TestMethod]
+ public void Ps1NamedWrong()
+ {
+ TestScript(psNamedPath.FullName, "-wrong 'world'");
+ Assert.IsTrue(log.WarningMessages.Count == 1);
+ Assert.IsTrue(log.ErrorMessages.Count == 1);
+ }
+
+ [TestMethod]
+ public void Ps1NamedCorrect()
+ {
+ TestScript(psNamedPath.FullName, "-what 'world'");
+ Assert.IsTrue(log.WarningMessages.Count == 0);
+ Assert.IsTrue(log.ErrorMessages.Count == 0);
+ }
+
+
}
}