I'm using .NET 3.5 and want an Nunit test to test async code in a delegate/lambda expression, but can't get it to work. Can anyone please give some advice on how to do this, if it's possible? Here's an example (SomeMethod returns straight away, and calls OnDone at a later time):
[Test]
public void MyTest()
{
MyClass.SomeMethod(123, OnDone);
}
private void OnDone(object sender, MyEventArgs e)
{
Assert.AreEqual(123, e.Value);
}
SomeMethoddo? It seems like it's returning before executing the delegate.