Beispiel #1
0
 public void MandatoryValueIsGatheredIfNotProvided()
 {
     var ui = new TestHostUserInterface();
     string val = "foobar";
     ui.SetInput(val + Environment.NewLine);
     var res = TestHost.Execute(true, null, ui, CmdletName(typeof(TestWithMandatoryCommand)));
     var lines = res.Split(new [] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
     Assert.AreEqual(TestWithMandatoryCommand.Transform(val), lines[lines.Length - 1]);
 }
Beispiel #2
0
 public void ValueGatheringCanProvideHelp()
 {
     var ui = new TestHostUserInterface();
     string val = "test";
     string input = "!?" + Environment.NewLine + val + Environment.NewLine;
     ui.SetInput(input);
     var res = TestHost.Execute(true, null, ui, CmdletName(typeof(TestWithMandatoryCommand)));
     var lines = res.Split(new [] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
     Assert.Greater(lines.Length, 3, "Not enough output");
     Assert.AreEqual(TestWithMandatoryCommand.Transform(val), lines[lines.Length - 1]);
     Assert.AreEqual(TestWithMandatoryCommand.HELP_MSG, lines[lines.Length - 3]);
 }