public void IspitDeleteCorrectID() { var db = new TestStudentIspitiContext(); db.Initialize(); IspitController controller = new IspitController(db); int i = 2; var result = controller.Delete(i) as ViewResult; Assert.IsNotNull(result); Assert.IsInstanceOfType(result.Model, typeof(Ispit)); }
public void IspitDeleteNotCorrectID() { var db = new TestStudentIspitiContext(); db.Initialize(); IspitController controller = new IspitController(db); int i = 100; var result = controller.Delete(i); Assert.IsInstanceOfType(result, typeof(HttpNotFoundResult)); var httpResult = result as HttpNotFoundResult; Assert.AreEqual(404, httpResult.StatusCode); }
public void IspitDeleteNullTest() { /*Test Delete when null is passed*/ var db = new TestStudentIspitiContext(); db.Initialize(); IspitController controller = new IspitController(db); int? i = null; var result = controller.Delete(i); Assert.IsInstanceOfType(result, typeof(System.Web.Mvc.HttpStatusCodeResult)); var httpResult = result as HttpStatusCodeResult; Assert.AreEqual(400, httpResult.StatusCode); }