public void Grades_Controller_Test_On_CreateModel_With_Invalid_Model() { //Arrange Guid id = new Guid("f616cc8c-2223-4145-b7d0-232a1f6f0795"); int value = 10; DateTime date = DateTime.Now; Grade expectedGrades = new Grade(value, date); expectedGrades.Id = id; GradeModel expectedModel = new GradeModel(); expectedModel.Value = 1; var repo = Substitute.For <IRepository>(); var sut = new GradesController(repo); repo.Create(expectedGrades); //Act sut.ModelState.AddModelError("Title", "Title Required"); var actual = sut.Create(expectedModel).Result; //Assert Assert.IsInstanceOfType(actual, typeof(ViewResult)); }
public void Grades_Controller_Test_On_Create() { //Arrange var repo = Substitute.For <IRepository>(); var sut = new GradesController(repo); //Act var actual = sut.Create(); //Assert Assert.IsInstanceOfType(actual, typeof(ViewResult)); }
public void Create_ViewLoads() { var result = (ViewResult)controller.Create(); Assert.AreEqual("Create", result.ViewName); }