I would like to test if function received a specific delegate as parameter. Is it possible in NUnit with NSubstitute?
My interface:
public interface IMyInterface
{
void Sort(Func<IEnumerable<int>, IOrderedEnumerable<int>> f);
}
My test class:
[TestFixture]
public class Class1
{
[Test]
public void Sort_WhenCalled_CallsWithPassedArgument()
{
// Arrange
IMyInterface mock = Substitute.For<IMyInterface>();
// Act
mock.Sort(x => x.OrderBy(y => y));
// Assert
mock.Received().Sort(x => x.OrderBy(y => y));
}
}
I also tried with argument matchers, but it always fails.