public void Grades_Controller_Test_On_Delete_Confirmed_With_Existent_Id() { //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; var repo = Substitute.For <IRepository>(); var sut = new GradesController(repo); repo.GetById <Grade>(id).Returns(expectedGrades); //Act var actual = sut.DeleteConfirmed(id).Result; //Assert Assert.IsInstanceOfType(actual, typeof(RedirectToActionResult)); }
public void Delete_Confirmed_NoId() { ViewResult result = (ViewResult)controller.DeleteConfirmed(null); Assert.AreEqual("Error", result.ViewName); }