Skip to content

Instantly share code, notes, and snippets.

@phatboyg
Created September 9, 2012 17:30
Show Gist options
  • Save phatboyg/3685905 to your computer and use it in GitHub Desktop.
Save phatboyg/3685905 to your computer and use it in GitHub Desktop.
Extensible Command Line Arguments for Topshelf
[Test]
public void Extensible_the_command_line_should_be_yes()
{
bool isSuperfly = false;
Host host = HostFactory.New(x =>
{
x.Service<MyService>();
x.AddCommandLineSwitch("superfly", v => isSuperfly = v);
x.ApplyCommandLine("--superfly");
});
Assert.IsTrue(isSuperfly);
}
[Test]
public void Extensible_the_command_line_should_be_yet_again()
{
string volumeLevel = null;
Host host = HostFactory.New(x =>
{
x.Service<MyService>();
x.AddCommandLineDefinition("volumeLevel", v => volumeLevel = v);
x.ApplyCommandLine("-volumeLevel:11");
});
Assert.AreEqual("11", volumeLevel);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment