public void ShouldNot_PostVenue_ModelStateError() { Venue testVenue = new Venue { Id = 1, Address1 = "Addr1", Address2 = "Addr2", Address3 = "Addr3", Address4 = "Addr4", Address5 = "Addr5", Description = "Test", ContactPhone = "01234567898", Image = "", LatLong = "0,0", Name = "Test", Instagram = "inst", Facebook = "fb", Twitter = "tw" }; Mock <IUnitOfWork> mock = new Mock <IUnitOfWork>(); mock.Setup(f => f.Venues.Create(testVenue)).Returns(true); mock.Setup(f => f.Venues.GetById(1)).Returns(testVenue); VenuesController controller = new VenuesController(mock.Object); controller.ModelState.AddModelError("TestError", "Error"); var venues = controller.PostVenue(testVenue); Assert.IsType <BadRequestObjectResult>(venues); }