public void PartialUpdateGenre_Returns_NoContent() { // Arrange var genreRepositoryMock = new Mock <IGenreRepository>(); var genreIMapperMock = new MapperConfiguration(config => { config.AddProfile(new MovieMapper()); }); var genreMapper = genreIMapperMock.CreateMapper(); var logMock = new Mock <ILogger <GenresController> >(); ILogger <GenresController> logger = logMock.Object; GenresController genreApiController = new GenresController(genreRepositoryMock.Object, mapper: genreMapper, logger); var patchDoc = new JsonPatchDocument <GenreDTO>(); var genreDto = new GenreDTO() { Name = "Comedy", DateCreated = DateTime.Parse("15 May 2015"), Id = Guid.NewGuid() }; var genreModel = new GenreModel() { Name = "Comedy", DateCreated = DateTime.Parse("15 May 2015"), Id = Guid.NewGuid() }; patchDoc.ApplyTo(genreDto, genreApiController.ModelState); genreRepositoryMock.Setup(repo => repo.GetGenre(It.IsAny <Guid>())) .Returns(genreModel); genreRepositoryMock.Setup(repo => repo.UpdateGenre(It.IsAny <GenreModel>())) .Returns(true); // Act var genreResult = genreApiController.PartialUpdateGenre(genreModel.Id, patchDoc); var noContentResult = genreResult as NoContentResult; // Assert Assert.True(noContentResult.StatusCode is StatusCodes.Status204NoContent); }