public async Task ReturnsBadRequestWhenModelErrors() { _controller.ModelState.AddModelError(nameof(Video.VideoName), ""); var result = await _controller.Post(new Video()); result.Should().BeOfType <BadRequestObjectResult>(); }
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); }