I have a class implementation as shown below. MethodUnderTest () is a method that calls the delegate to update the grid using some custom filter with a callback function - UpdateGridCallback.
public class MyClass
{
public delegate void UpdateGridDelegate(MyCustomFilters filter);
public UpdateGridDelegate del;
public MyCustomFilters filter;
public void MethodUnderTest()
{
del = new UpdateGridDelegate(UpdateGrid);
del.BeginInvoke(filter, UpdateGridCallback, null);
}
public void UpdateGrid(MyCustomFilters filter)
{
}
public void UpdateGridCallback(IAsyncResult result)
{
}
}
I use Nunit and Moq.delegate. MethodUnderTest () is the method that is being tested. How do I make fun of the delegate that is used in MethodUnderTest ()?
I want to make sure that the delegate was called (or a callback was made) from my NUnit test case.
source
share