示例#1
0
 //TODO: FIX
 public ExpenseFormModel(Expense expense)
 {
     this.ExpenseId = expense.ExpenseId;
     this.CategoryId = expense.Category.CategoryId;
     this.Date = expense.Date;
     this.Amount = expense.Amount;
     this.Transaction = expense.TransactionDesc;
 }
示例#2
0
        public void ExpenseCreateTest()
        {
            using (var lifetime = container.BeginLifetimeScope())
            {
                DefaultCommandBus commandBus = lifetime.Resolve<DefaultCommandBus>();
                ICategoryRepository categoryRepository = lifetime.Resolve<ICategoryRepository>();
                IMappingEngine mapper = lifetime.Resolve<IMappingEngine>();

                Category category = categoryRepository.GetAll().FirstOrDefault();

                Expense expense = new Expense()
                {
                    Amount = 120,
                    Date = DateTime.Now,
                    Category = category,
                    TransactionDesc = "Test transaction."
                };

                CreateOrUpdateExpenseCommand command = mapper.Map<CreateOrUpdateExpenseCommand>(expense);

                ICommandHandler<CreateOrUpdateExpenseCommand> commnadHandler = lifetime.Resolve<ICommandHandler<CreateOrUpdateExpenseCommand>>();
                ICommandResult result = commandBus.Submit(command, commnadHandler);
                Assert.IsNotNull(result, "Error: Tipo Via Was Not Created by CommandBus");
                Assert.IsTrue(result.Success, "Error: Tipo Via Was Not Created by CommandBus");
            }
        }