Пример #1
0
        public void NotConvertBO_WithNull()
        {
            AppendixBO bo = null;
            var        convertedEntity = _converter.Convert(bo);

            Assert.Null(convertedEntity);
        }
Пример #2
0
 public bool Save(AppendixBO appendix)
 {
     using (var unitOfWork = _uow)
     {
         var convertedAppendix = _converter.Convert(appendix);
         var savedAppendix     = unitOfWork.AppendixRepository.Save(convertedAppendix);
         unitOfWork.Complete();
         return(savedAppendix);
     }
 }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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"));
            }
        }