public async Task AddShouldSucceed() { var itemToAdd = new Domain.Entities.CostType() { CostTypeDescription = "new item" }; var result = await _costTypeService.Add(itemToAdd); result.CostTypeDescription.Should().BeEquivalentTo(itemToAdd.CostTypeDescription); }
public async Task <IActionResult> Create(CostTypeModel model) { try { var newItem = await _costTypeService.Add(new Domain.Entities.CostType() { CostTypeDescription = model.CostTypeDescription }); AddSuccessMessage(Constants.MessageTexts.SuccessMessage); return(RedirectToAction(nameof(Index), new { id = newItem.CostTypeId })); } catch { AddErrorMessage(Constants.MessageTexts.ErrorMessage); return(View()); } }