public void NavigateTo(bool simulateSuccess) { MockRepository mocks = new MockRepository(); IGallioNavigator navigator = mocks.StrictMock<IGallioNavigator>(); using (mocks.Record()) { Expect.Call(navigator.NavigateTo( @"C:\Source\MbUnit\v3\src\Gallio\Gallio.Tests\Reflection\Impl\CecilReflectionPolicyTest.cs", 5, 11)) .Return(simulateSuccess); } using (mocks.Playback()) { InstrumentedProgram program = new InstrumentedProgram(); program.Engine = navigator; int returnCode = program.Run(new string[] { @"gallio:navigateTo?path=C:\Source\MbUnit\v3\src\Gallio\Gallio.Tests\Reflection\Impl\CecilReflectionPolicyTest.cs&line=5&column=11" }); Assert.IsFalse(program.HelpCalled); Assert.AreEqual(simulateSuccess ? 0 : 1, returnCode); mocks.VerifyAll(); } }
public void NavigateTo(bool simulateSuccess) { MockRepository mocks = new MockRepository(); IGallioNavigator navigator = mocks.StrictMock <IGallioNavigator>(); using (mocks.Record()) { Expect.Call(navigator.NavigateTo( @"C:\Source\MbUnit\v3\src\Gallio\Gallio.Tests\Reflection\Impl\CecilReflectionPolicyTest.cs", 5, 11)) .Return(simulateSuccess); } using (mocks.Playback()) { InstrumentedProgram program = new InstrumentedProgram(); program.Engine = navigator; int returnCode = program.Run(new string[] { @"gallio:navigateTo?path=C:\Source\MbUnit\v3\src\Gallio\Gallio.Tests\Reflection\Impl\CecilReflectionPolicyTest.cs&line=5&column=11" }); Assert.IsFalse(program.HelpCalled); Assert.AreEqual(simulateSuccess ? 0 : 1, returnCode); mocks.VerifyAll(); } }
public void CallsHelpWhenTooManyArguments() { InstrumentedProgram program = new InstrumentedProgram(); int returnCode = program.Run(new string[] { "a", "b" }); Assert.IsTrue(program.HelpCalled); Assert.AreEqual(1, returnCode); }