Exemple #1
0
        public async Task StartedBy(FakeStartingCommand command)
        {
            var data = new MyData()
            {
                Value1 = command.Value1, Value2 = "qwe"
            };
            await Repository.Save(command.Headers.CorrelationId, data);

            await ServiceBus.Send(new FakeStep2Command(command.AggregateId, command.Headers.CorrelationId, data.Value1, command.Who));
        }
Exemple #2
0
        public async Task Saga_StartsWithCommand()
        {
            var command = new FakeStartingCommand(new MyDomainId(Guid.NewGuid()), correlationId, "abc", "user_tester");
            await serviceBus.Send(command);

            var commands = serviceBus.SentCommands();

            Assert.Equal(2, commands.Count);
            Assert.IsType <FakeStep2Command>(commands[1]);
            Assert.Equal("abc", ((FakeStep2Command)commands[1]).Value1);

            var data = await inMemorySagaRepository.GetById <SagaToTest.MyData>(correlationId);

            Assert.Null(data);
        }