public async Task DeleteStudentTest() { int id = 6; var Del_students = await controller.DeleteStudents(id); var response = await controller.GetStudents(id); Assert.AreEqual(null, response.Value); }
public void DeleteStudentTest() { int id = 1; int Exist = 1; var Del_students = controller.DeleteStudents(id); //Get Updated Count of The Student //int New_count = (from x in _context.Students select x).Count(); // int New_count = 2; //Verify Count // int Del_Count = count - New_count; //bool Exist = controller.StudentsExists(id); Assert.AreEqual(false, Exist); }
public void TestDeleteStudent() { //ARRANGE StudentsController controller = new StudentsController(); Students students = new Students() { StudentID = 7, LastName = "Jimenez", FirstName = "Lizeth", EnrollmentDate = DateTime.Now }; //ACT IHttpActionResult actionResultPost = controller.PostStudents(students); IHttpActionResult actionResultDelete = controller.DeleteStudents(students.StudentID); //ASSERT Assert.IsInstanceOfType(actionResultDelete, typeof(OkNegotiatedContentResult<Students>)); }