public IActionResult Add([FromBody] RuleModel model) { if (!ModelState.IsValid) { NotifyModelStateErrors(); return(Response()); } _ruleApplicationService.Add(model); return(Response()); }
public void RuleApplicationService_Add() { var model = new RuleModel() { Days = 1, InterestPerDay = 0.2m, Penalty = 2, Type = (short)RuleType.After }; _ruleApplicationService.Add(model); var result = _ruleRepository.Get(new Filter()); result.entities.Should().HaveCount(1); var entity = result.entities.First(); entity.Days.Should().Be(model.Days); entity.InterestPerDay.Should().Be(model.InterestPerDay); entity.Penalty.Should().Be(model.Penalty); entity.Type.Should().Be((RuleType)model.Type); }