public void A_Aggregate_must_work_when_using_Source_RunAggregate() { this.AssertAllStagesStopped(() => { var task = InputSource.RunAggregate(0, (sum, i) => sum + i, Materializer); task.AwaitResult().Should().Be(Expected); }, Materializer); }
public void A_Aggregate_must_work_when_using_Source_RunFold() { this.AssertAllStagesStopped(() => { var task = InputSource.RunAggregate(0, (sum, i) => sum + i, Materializer); task.Wait(TimeSpan.FromSeconds(3)).Should().BeTrue(); task.Result.Should().Be(Expected); }, Materializer); }
A_Aggregate_must_complete_task_with_failure_when_the_aggregateing_function_throws_and_the_supervisor_strategy_decides_to_stop() { this.AssertAllStagesStopped(() => { var error = new TestException("buh"); var future = InputSource.RunAggregate(0, (x, y) => { if (x > 50) { throw error; } return(x + y); }, Materializer); future.Invoking(f => f.Wait(TimeSpan.FromSeconds(3))) .ShouldThrow <TestException>() .And.Should() .Be(error); }, Materializer); }
public void A_Aggregate_must_complete_future_with_failure_when_folding_functions_throws() { this.AssertAllStagesStopped(() => { var error = new TestException("buh"); var future = InputSource.RunAggregate(0, (x, y) => { if (x > 50) { throw error; } return(x + y); }, Materializer); future.Invoking(f => f.Wait(TimeSpan.FromSeconds(3))) .ShouldThrow <TestException>() .And.Should() .Be(error); }, Materializer); }