Пример #1
0
        public async Task ReturnsBadRequestWhenModelErrors()
        {
            _controller.ModelState.AddModelError(nameof(Video.VideoName), "");

            var result = await _controller.Post(new Video());

            result.Should().BeOfType <BadRequestObjectResult>();
        }
Пример #2
0
        public void NotPostWithInvalidObject_ReturnBadRequest()
        {
            MockVideoService.Setup(s => s.Create(It.IsAny <VideoBO>())).Returns(new VideoBO());
            var video = new VideoBO();

            _controller.ModelState.AddModelError("", "");
            var result = _controller.Post(video);

            Assert.IsType <BadRequestObjectResult>(result);
        }