public async Task SubdomainTestFlowWithState_ExecutionFailed_StopsExecution() { mediator.SetupRequestHandler <CommandRequest <FakeCommand>, IExecutionResult>(request => new FailedResult(CoreErrorCodes.UnhandledError)); var step1 = new FakeCommandStep(); var step2 = new FakeCommandStep(); var(result, context) = await testHost.CreateFlow <FakeSubdomainState>() .With(step1) .With(step2) .RunAsync(); result.Should().BeOfType <FailedResult>(); context.ExecutedCommands.Should().HaveCount(1); context.ExpectedEvents.Should().HaveCount(1); }
public async Task SubdomainTestFlowWithState_ExecutionSucceed_UpdatesContext() { mediator.SetupRequestHandler <CommandRequest <FakeCommand>, IExecutionResult>(request => new SuccessfulResult()); var step = new FakeCommandStep(); var(result, context) = await testHost.CreateFlow <FakeSubdomainState>() .With(step) .RunAsync(); result.Should().BeOfType <SuccessfulResult>(); context.ExecutedCommands.Single().Should().BeOfType <FakeCommand>() .Which.Key.Should().Be(step.CommandKey); context.ExpectedEvents.Single().Should().BeOfType <FakeIntegrationEvent>() .Which.Key.Should().Be(step.EventKey); }