Example #1
0
        public async Task ReturnsBadRequestWhenModelErrors()
        {
            _controller.ModelState.AddModelError(nameof(Video.VideoName), "");

            var result = await _controller.Put(Guid.NewGuid(), new Video());

            result.Should().BeOfType <BadRequestResult>();
        }
Example #2
0
        public void NotUpdateWithInvalidObject_ReturnBadRequest()
        {
            MockVideoService.Setup(s => s.Update(It.IsAny <VideoBO>())).Returns(new VideoBO());

            var video = new VideoBO();

            _controller.ModelState.AddModelError("", "");

            var result = _controller.Put(0, video);

            Assert.IsType <BadRequestObjectResult>(result);
        }