Skip to content

Instantly share code, notes, and snippets.

@adamralph
Last active December 14, 2015 11:09
Show Gist options
  • Save adamralph/5076908 to your computer and use it in GitHub Desktop.
Save adamralph/5076908 to your computer and use it in GitHub Desktop.
FakeItEasy Should_match_lambda_arguments
[Test]
public void Should_match_lambda_arguments()
{
// Arrange
var fake = A.Fake<ITypeWithMethodWithDelegateParameter>();
var action = (Action)(() => { });
var other = (Action)(() => { });
// Act
fake.Foo(action);
// Assert
A.CallTo(() => fake.Foo(action)).MustHaveHappened();
A.CallTo(() => fake.Foo(other)).MustNotHaveHappened();
}
public interface ITypeWithMethodWithDelegateParameter
{
void Foo(Action action);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment