Issue #178 - Add unit tests for argument ant arguments config entries

pull/179/head
Oleg Nenashev 2017-01-04 23:14:49 +01:00
parent 48a5bdd222
commit b27c523f0a
1 changed files with 44 additions and 0 deletions

View File

@ -311,5 +311,49 @@ namespace winswTests
var sd = ConfigXmlBuilder.create().WithTag("stoptimeout", "35 secs").ToServiceDescriptor(true); var sd = ConfigXmlBuilder.create().WithTag("stoptimeout", "35 secs").ToServiceDescriptor(true);
Assert.That(sd.StopTimeout, Is.EqualTo(TimeSpan.FromSeconds(35))); Assert.That(sd.StopTimeout, Is.EqualTo(TimeSpan.FromSeconds(35)));
} }
/// <summary>
/// https://github.com/kohsuke/winsw/issues/178
/// </summary>
[Test]
public void Arguments_LegacyParam()
{
var sd = ConfigXmlBuilder.create().WithTag("arguments", "arg").ToServiceDescriptor(true);
Assert.That(sd.Arguments, Is.EqualTo("arg"));
}
[Test]
public void Arguments_NewParam_Single()
{
var sd = ConfigXmlBuilder.create()
.WithTag("argument", "--arg1=2")
.ToServiceDescriptor(true);
Assert.That(sd.Arguments, Is.EqualTo(" --arg1=2"));
}
[Test]
public void Arguments_NewParam_MultipleArgs()
{
var sd = ConfigXmlBuilder.create()
.WithTag("argument", "--arg1=2")
.WithTag("argument", "--arg2=123")
.WithTag("argument", "--arg3=null")
.ToServiceDescriptor(true);
Assert.That(sd.Arguments, Is.EqualTo(" --arg1=2 --arg2=123 --arg3=null"));
}
/// <summary>
/// Ensures that the new single-argument field has a higher priority.
/// </summary>
[Test]
public void Arguments_Bothparam_Priorities()
{
var sd = ConfigXmlBuilder.create()
.WithTag("arguments", "--arg1=2 --arg2=3")
.WithTag("argument", "--arg2=123")
.WithTag("argument", "--arg3=null")
.ToServiceDescriptor(true);
Assert.That(sd.Arguments, Is.EqualTo(" --arg2=123 --arg3=null"));
}
} }
} }