public class UserProviderTest { // ... [Test] public void Get_WhenUserDoesNotExist_ReturnsError() { string result = null; // The stub invokes the callbacks synchronously. sut.Get(2, (User user) => { Assert.Fail("Success callback should not be called"); }, (string error) => { result = error; }); Assert.That(result, Is.Not.Null); Assert.That(result, Is.EqualTo("User not found")); } }