public async Task FailSomethingAsyncTest() { try { await _decorated.FailSomethingAsync(); Assert.Fail("Expected exception"); } catch (Exception e) { AssertLog("FailSomethingAsync called", $"FailSomethingAsync threw {e.GetType()}"); } }
public async Task FailSomethingAsyncTest() { Exception exception = null; try { await _decorated.FailSomethingAsync(); } catch (Exception e) { exception = e; } Assert.AreEqual(2, _log.Count); Assert.AreEqual("Calling FailSomethingAsync().", _log.Dequeue().Message); Assert.AreEqual("Exception InvalidOperationException: i i i from FailSomethingAsync().", _log.Dequeue().Message); }