public void AccountApplicationService_Add() { var model = new AccountModel { OriginalValue = 10, PaymentDate = DateTime.Now.Date, DueDate = DateTime.Now.AddDays(-2).Date, Name = "test" }; var rule = new RuleBuilder().WithDays(3).WithType(RuleType.UpUntil).WithPenalty(2).WithInterestPerDay(0.2m).Builder(); _ruleRepository.Add(rule); _unitOfWork.Commit(); _accountApplicationService.Add(model); var result = _accountRepository.Get(new Filter()); result.entities.Should().HaveCount(1); var entity = result.entities.First(); entity.OriginalValue.Should().Be(10); entity.RuleId.Should().Be(rule.Id); entity.CorrectedValue.Should().Be(10.24m); entity.NumberOfDaysLate.Should().Be(2); }
public IActionResult Add([FromBody] AccountModel model) { if (!ModelState.IsValid) { NotifyModelStateErrors(); return(Response()); } _accountApplicationService.Add(model); return(Response()); }