public void QuadrupleParameterDoWillInvokeMethodWithCorrectParameters( int expectedNumber, string expectedText, Type expectedType, bool expectedBool) { // Fixture setup var fixture = new Fixture(); fixture.Inject(expectedNumber); fixture.Inject(expectedText); fixture.Inject(expectedType); fixture.Inject(expectedBool); var verified = false; var mock = new CommandMock <int, string, Type, bool>(); mock.OnCommand = (x, y, z, æ) => verified = expectedNumber == x && expectedText == y && expectedType == z && expectedBool == æ; // Exercise system fixture.Do( (int x, string y, Type z, bool æ) => mock.Command(x, y, z, æ)); // Verify outcome Assert.True(verified, "Mock wasn't verified."); // Teardown }
public void TripleParameterDoWillInvokeMethodWithCorrectParameters( string expectedText, int expectedNumber, bool expectedBool) { // Fixture setup var fixture = new Fixture(); fixture.Inject(expectedText); fixture.Inject(expectedNumber); fixture.Inject(expectedBool); var verified = false; var mock = new CommandMock <string, int, bool>(); mock.OnCommand = (x, y, z) => verified = expectedText == x && expectedNumber == y && expectedBool == z; // Exercise system fixture.Do((string x, int y, bool z) => mock.Command(x, y, z)); // Verify outcome Assert.True(verified, "Mock wasn't verified."); // Teardown }
public void SingleParameterDoWillInvokeMethodWithCorrectParameter( int expected) { // Fixture setup var builder = new DelegatingSpecimenBuilder(); builder.OnCreate = (r, c) => expected; var verified = false; var mock = new CommandMock <int>(); mock.OnCommand = x => verified = expected == x; // Exercise system builder.Do((int i) => mock.Command(i)); // Verify outcome Assert.True(verified, "Mock wasn't verified."); // Teardown }
public void DoubleParameterDoWillInvokeMethodWithCorrectParameters( int expectedNumber, string expectedText) { // Fixture setup var fixture = new Fixture(); fixture.Inject(expectedNumber); fixture.Inject(expectedText); var verified = false; var mock = new CommandMock <int, string>(); mock.OnCommand = (x, y) => verified = expectedNumber == x && expectedText == y; // Exercise system fixture.Do((int x, string y) => mock.Command(x, y)); // Verify outcome Assert.True(verified, "Mock wasn't verified."); // Teardown }