public async Task CreateCanceled() { var exception = new CustomOperationCanceledException(); var task = TaskUtilities.CreateCanceled<int>(exception); task.Status.Should().Be(TaskStatus.Canceled); task.IsCanceled.Should().Be(true); Func<Task<int>> f = async () => await task; await f.ShouldThrowAsync<CustomOperationCanceledException>(); }
public async Task CreateCanceled() { var exception = new CustomOperationCanceledException(); var task = TaskUtilities.CreateCanceled <int>(exception); task.Status.Should().Be(TaskStatus.Canceled); task.IsCanceled.Should().Be(true); Func <Task <int> > f = async() => await task; await f.ShouldThrowAsync <CustomOperationCanceledException>(); }