public async Task Constructor_AddsMetadataSaveTransactionToUoW()
        {
            unitOfWork.Received(1).AddInnerTransaction(Arg.Any <ITransaction>());
            uowInnerTransaction.Should().NotBeNull();

            Saga1 saga1 = new Saga1(Guid.NewGuid());

            saga1.Do();
            sut.Add(saga1);

            IEnumerable <KeyValuePair <string, string> > sagaKeys = null;

            sagaMetadataRepository.When(x => x.SetSagaKeysAsync(saga1.Id, Arg.Any <IEnumerable <KeyValuePair <string, string> > >())).Do(
                ci => sagaKeys = ci.ArgAt <IEnumerable <KeyValuePair <string, string> > >(1));

            await uowInnerTransaction.CommitAsync();

            sagaMetadataRepository.Received(1).SaveChangesAsync();

            Received.InOrder(() =>
            {
                sagaMetadataRepository.SetSagaKeysAsync(saga1.Id, Arg.Any <IEnumerable <KeyValuePair <string, string> > >());
                sagaMetadataRepository.SaveChangesAsync();
            });

            sagaKeys.Should()
            .BeEquivalentTo(saga1.Keys.SelectMany(x =>
                                                  x.Value.Select(y => new KeyValuePair <string, string>(x.Key, y))));
        }
        public async Task SendSagaCommandsAsync_SendsCommands()
        {
            Saga1 saga1 = new Saga1(Guid.NewGuid());

            saga1.Do();
            sut.Add(saga1);

            ICommandBase command = saga1.UncommitedCommands.First();

            await sut.SendSagaCommandsAsync();

            commandBus.Received(1).SendAsync(command);
        }