I have a callback method called filter that take in a function and a single string parameter. In my code, filter is called two different times with different methods and parameters. Is there a way to set the parameter different for each instance filter is called?
private void method1 {
filter(iq1, function1);
}
private void method2 {
filter(iq2, function2);
}
This is how tried to set up the mock
private Mock<Filter> m = new Mock<Filter>();
string test1 = "hello";
string test2 = "goodbye";
var queue = new Queue<string>();
queue.Enqueue(test1);
queue.Enqueue(test2);
m.Setup(f => f.filter(It.IsNotNull<string>, It.IsAny<Action<Filter>>).Callback((string iq, Action<Filter> action) => action(queue.Dequeue());
I know that method1 calls filter before method2.