Exemplo n.º 1
0
        public void TestTransactionHandler()
        {
            var cmd = new MakeAccountingTransactionCommandDTO()
                          {
                              Amount = 5.0m,
                              Name = "tx1",
                              SourceAccountName = "root.subroot1",
                              DestinationAccountName = "root.subroot2"
                          };
            var hndl = Container.Resolve<MakeTransactionCommandHandler>();

            hndl.Handle(cmd);

            Assert.AreEqual(10.0, Container.Resolve<IAccountRepository>().GetRootAccount().GetTurnover());
        }
Exemplo n.º 2
0
 public void ExecuteCommand(MakeAccountingTransactionCommandDTO dto, IUnitOfWork uow)
 {
     using (var tx = uow.CreateTransaction())
     {
         var hndl = _container.Resolve<MakeTransactionCommandHandler>();
         hndl.Handle(dto);
         tx.Commit();
     }
 }