public void AsyncProcessorShouldProcess() { // Arrange var waitHandle = new ManualResetEvent(false); bool result = false; var sut = new TestProcessor(); sut.Complete += (o, e) => { waitHandle.Set(); result = e.Result; }; // Act Assert.IsFalse(sut.Processed); sut.ProcessAsync(123); // Assert bool handleSet = waitHandle.WaitOne(); Assert.IsTrue(handleSet); ////Assert.IsTrue(result); // This fails when run within Suite-Run Assert.IsTrue(sut.Processed); }
public void AsyncProcessorShouldProcess() { // Arrange var waitHandle = new ManualResetEvent(false); var sut = new TestProcessor(); sut.Complete += delegate { waitHandle.Set(); }; // Act Assert.IsFalse(sut.Processed); sut.ProcessAsync(); // Assert bool handleSet = waitHandle.WaitOne(); Assert.IsTrue(handleSet); Assert.IsTrue(sut.Processed); }