Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Hsu <kennethhsu@gmail.com>2020-11-01 23:32:47 +0300
committerKenneth Hsu <kennethhsu@gmail.com>2020-11-02 00:14:00 +0300
commitca5aad9ccb5b59f6c1dc3bf7ae6c35713a9778d7 (patch)
tree327b295bc60e10cd63da3a5f70f619f475643714 /Duplicati/UnitTest
parent49e026ee92f3856a11bcbab8c62637ecf8263247 (diff)
Allow custom commands to be provided to CreateScript test helper.
Diffstat (limited to 'Duplicati/UnitTest')
-rw-r--r--Duplicati/UnitTest/RunScriptTests.cs9
1 files changed, 7 insertions, 2 deletions
diff --git a/Duplicati/UnitTest/RunScriptTests.cs b/Duplicati/UnitTest/RunScriptTests.cs
index 38c0fad59..c4117fd46 100644
--- a/Duplicati/UnitTest/RunScriptTests.cs
+++ b/Duplicati/UnitTest/RunScriptTests.cs
@@ -148,12 +148,12 @@ namespace Duplicati.UnitTest
}
- private string CreateScript(int exitcode, string stderr = null, string stdout = null, int sleeptime = 0)
+ private string CreateScript(int exitcode, string stderr = null, string stdout = null, int sleeptime = 0, List<string> customCommands = null)
{
var id = Guid.NewGuid().ToString("N").Substring(0, 6);
if (Platform.IsClientWindows)
{
- var commands = new List<string>();
+ var commands = customCommands ?? new List<string>();
if (!string.IsNullOrWhiteSpace(stdout))
commands.Add($@"echo {stdout}");
if (!string.IsNullOrWhiteSpace(stderr))
@@ -173,6 +173,11 @@ namespace Duplicati.UnitTest
var commands = new List<string>();
commands.Add("#!/bin/sh");
+ if (customCommands != null)
+ {
+ commands.AddRange(customCommands);
+ }
+
if (!string.IsNullOrWhiteSpace(stdout))
commands.Add($@"echo {stdout}");
if (!string.IsNullOrWhiteSpace(stderr))