Ejemplo n.º 1
0
        public async Task SaveLedger_Success()
        {
            var model = new Domain.Models.Ledger {
                Name = "TestLedger", Description = "TestLedger description"
            };
            var request = new SaveLedgerRequest(model);

            var handler = new SaveLedgerRequestHandler(_trackingContext, Mapper.Instance);
            var result  = await handler.Handle(request, default(CancellationToken));

            Assert.AreEqual(result, Unit.Value);
        }
Ejemplo n.º 2
0
        public async Task SaveLedger_Validation(string ledgerName, bool instantiateModel, bool isValid)
        {
            Domain.Models.Ledger model = null;
            if (instantiateModel)
            {
                model = new Domain.Models.Ledger {
                    Name = ledgerName
                };
            }
            var request          = new SaveLedgerRequest(model);
            var validator        = new SaveLedgerValidator();
            var validationResult = await validator.ValidateAsync(request);

            Assert.AreEqual(isValid, validationResult.IsValid);
        }
 public async Task Create([FromBody] Domain.Models.Ledger model)
 {
     await _mediator.Send(new SaveLedgerRequest(model));
 }