public void ThenAsyncTOut_WhenExecuteIsNull_ThrowsArgumentNullException() { TryResult t = ""; Func <Task <TryResult <int> > > t2 = null; Assert.ThrowsAsync <ArgumentNullException>(() => t.ThenAsync(t2)); }
public async Task ThenAsyncTOut_WhenTryFailed_ReturnsOriginalError() { TryResult t = "err"; var t2 = await t.ThenAsync(async() => 1); Assert.AreEqual(t.ErrorMessage, t2.ErrorMessage); }
public async Task ThenAsync_WhenTryFailed_DoesNotExecute() { TryResult t = "err"; var executed = false; await t.ThenAsync(async() => { executed = true; }); Assert.IsFalse(executed); }
public async Task ThenAsync_WhenTrySucceeded_Executes() { TryResult t = TryResult.Succeed(); var executed = false; await t.ThenAsync(async() => { executed = true; }); Assert.IsTrue(executed); }
public void ThenAsyncTOut_WhenTryResultIsNull_ThrowsArgumentNullException() { TryResult t = null; Assert.ThrowsAsync <ArgumentNullException>(() => t.ThenAsync(async() => 1)); }
public void ThenAsync_WhenExecuteIsNull_ThrowsArgumentNullException() { TryResult t = ""; Assert.ThrowsAsync <ArgumentNullException>(() => t.ThenAsync(null)); }