Пример #1
0
        public void ATemplateContoller_GetOne()
        {
            ATemplateController _controller = new ATemplateController(_mockService.Object, _logger.Object);
            var result = _controller.Get(1);

            Assert.IsNotNull(result);
        }
Пример #2
0
        public void ATemplateContoller_GetOne_ReturnsBadRequestOnException()
        {
            _mockService.Setup(m => m.GetById(It.IsAny <int>())).Throws(new System.Exception("Test Exception"));
            ATemplateController _controller = new ATemplateController(_mockService.Object, _logger.Object);

            var result = _controller.Get(1);

            Assert.IsTrue(result.Result is BadRequestObjectResult);
        }
Пример #3
0
        public void ATemplateContoller_Post()
        {
            ATemplateViewModel application = new ATemplateViewModel()
            {
                Id = 1
            };
            ATemplateController _controller = new ATemplateController(_mockService.Object, _logger.Object);
            var result = _controller.Post(application);

            Assert.IsNotNull(result);
        }
Пример #4
0
        public void ATemplateContoller_Post_ReturnsBadRequestOnException()
        {
            _mockService.Setup(m => m.Add(It.IsAny <ATemplateViewModel>())).Throws(new System.Exception("Test Exception"));
            ATemplateController _controller = new ATemplateController(_mockService.Object, _logger.Object);

            ATemplateViewModel application = new ATemplateViewModel()
            {
                Id = 1
            };

            var result = _controller.Post(application);

            Assert.IsTrue(result.Result is BadRequestObjectResult);
        }