public async Task It_remains_invalid_if_exceptions_are_thrown() { var seed = 0; var producer = new PipelineStep <int>(() => { var next = Interlocked.Increment(ref seed); if (next == 1) { throw new InvalidOperationException(); } return(Task.FromResult(next)); }); producer.Awaiting(p => p.GetLatestAsync()) .Should() .Throw <InvalidOperationException>(); var value = await producer.GetLatestAsync(); value.Should().Be(2); }