Esempio n. 1
0
        public async Task Handler_creates_new_transaction_with_the_correct_properties()
        {
            var category = Persister <Data.Entity.Category> .New().Persist();

            var transaction = new Data.Entity.Transaction
            {
                CategoryId  = category.Id,
                Debit       = 100,
                Description = "Test transaction",
                Recorded    = DateTime.Now
            };

            var command  = new CreateTransactionCommand(transaction);
            var response = await mediator.ProcessCommandAsync <int>(command);

            Assert.IsTrue(response.Successful, "The command response is successful");

            var createdTransaction = await Context.Transactions.SingleAsync(p => p.Id == response.Result);

            Assert.That.This(createdTransaction).HasSameProperties(transaction, "Id");
            Assert.IsTrue(Context.Categories.Any());
        }
Esempio n. 2
0
 public UpdateTransactionCommand(int id, Data.Entity.Transaction transaction)
 {
     TransactionId = id;
     Transaction   = transaction;
 }
Esempio n. 3
0
 public CreateTransactionCommand(Data.Entity.Transaction transaction)
 {
     Transaction = transaction;
 }