Created
July 19, 2012 14:25
-
-
Save jhgbrt/3144300 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void EnsureDependencyIsCalledWithCorrectArguments() | |
{ | |
var dependency = MockRepository.GenerateMock<IDependency>(); | |
dependency.Expect(x => x.DoSomething(null, 0)) | |
.IgnoreArguments().Return(7).Repeat.Once(); | |
dependency.Expect(x => x.DoSomething(null, 0)) | |
.IgnoreArguments().Return(3).Repeat.Once(); | |
var systemUnderTest = new SystemUnderTest(dependency); | |
var returned = systemUnderTest.MethodUnderTest("MyData", 1234); | |
Assert.AreEqual(10, returned); | |
dependency.AssertWasCalled(d => | |
d.DoSomething(Arg<SomeComplexType>.Matches(t => t.stringData == "Sending MyData"), | |
Arg.Is(1111)) | |
); | |
dependency.AssertWasCalled(d => | |
d.DoSomething(Arg<SomeComplexType>.Matches(t => t.stringData == "Sending 1234"), | |
Arg.Is(2222)) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for this. :)