public void Details_Controller_Test_On_CreateModel_With_Invalid_Model() { //Arrange Guid id = new Guid("f616cc8c-2223-4145-b7d0-232a1f6f0795"); string feedBackMessage = "TestT"; int noOfPages = 10; int rating = 10; DateTime checkIn = DateTime.Now; DateTime checkOut = DateTime.Now.AddDays(1); Detail expectaDetail = new Detail(checkIn, checkOut, feedBackMessage, noOfPages, rating); expectaDetail.Id = id; DetailModel expectedModel = new DetailModel(); expectedModel.FeedbackMessage = " "; var repo = Substitute.For <IRepository>(); var sut = new DetailsController(repo); repo.Create(expectaDetail); //Act sut.ModelState.AddModelError("Title", "Title Required"); var actual = sut.Create(expectedModel).Result; //Assert Assert.IsInstanceOfType(actual, typeof(ViewResult)); }
public void Details_Controller_Test_On_Create() { //Arrange var repo = Substitute.For <IRepository>(); var sut = new DetailsController(repo); //Act var actual = sut.Create(); //Assert Assert.IsInstanceOfType(actual, typeof(ViewResult)); }