public void OverridingCommand_ShouldWork() { var command = new OverridingCommand(); var output = new StringWriter(); CommandDispatcher.DispatchCommand(command, new[] { "/n", "123" }, output).Should().Be(123); output.ToString().Should().BeNullOrEmpty(); }
public void ReturnCodeAndHalt() { var output = new StringWriter(); var command = new OverridingCommand(); var exitCode = ConsoleCommandDispatcher.DispatchCommand(command, new[] { "/n", "123" }, output); Assert.AreEqual(123, exitCode, "Exit code not 123 as expected"); Assert.That(String.IsNullOrEmpty(output.ToString()), "Output is not empty"); }
public override void Specify() { it("can specify a return code and halt execution", () => { var output = new StringWriter(); var command = new OverridingCommand(); var exitCode = arrange(() => ConsoleCommandDispatcher.DispatchCommand(command, new[] { "/n", "123" }, output)); expect(() => exitCode == 123); expect(() => String.IsNullOrEmpty(output.ToString())); }); }