public void NotConvertBO_WithNull() { AppendixBO bo = null; var convertedEntity = _converter.Convert(bo); Assert.Null(convertedEntity); }
public bool Save(AppendixBO appendix) { using (var unitOfWork = _uow) { var convertedAppendix = _converter.Convert(appendix); var savedAppendix = unitOfWork.AppendixRepository.Save(convertedAppendix); unitOfWork.Complete(); return(savedAppendix); } }
public void SaveAppendix() { _service.Setup(s => s.Save(It.IsAny <AppendixBO>())).Returns(() => true); var appendixToSave = new AppendixBO { Condition = "Test", Resources = "Test" }; var result = _controller.Save(appendixToSave); Assert.IsType <OkObjectResult>(result); }
public void SaveAppendix() { _repository.Setup(r => r.Save(It.IsAny <Appendix>())).Returns(() => true); var appendixToSave = new AppendixBO { Condition = "Test", Resources = "Test" }; var saved = _service.Save(appendixToSave); Assert.True(saved); }
public IActionResult Save([FromBody] AppendixBO appendix) { if (!ModelState.IsValid) { return(new BadRequestObjectResult(ModelState)); } var saved = _service.Save(appendix); if (saved) { return(new OkObjectResult("Appendix updated!")); } else { return(new BadRequestObjectResult("Couldn't save file")); } }