public void DeleteDetail_ReturnNotNullList() { var mock = new Mock <bookingrepo>(db); BookingsController obj = new BookingsController(mock.Object); var data = obj.DeleteDetail(1); var res = data as ObjectResult; Assert.IsNotNull(data); }
public void DeleteDetail_ValidInput_OkRequest() { var mock = new Mock <bookingrepo>(db); BookingsController obj = new BookingsController(mock.Object); var data = obj.DeleteDetail(1); var res = data as ObjectResult; Assert.AreEqual(200, res.StatusCode); }
public void DeleteDetail_InvalidInput_BadRequest() { try { var mock = new Mock <bookingrepo>(db); BookingsController obj = new BookingsController(mock.Object); var data = obj.DeleteDetail(0); var res = data as BadRequestObjectResult; Assert.AreEqual(400, res.StatusCode); } catch (Exception e) { Assert.AreEqual("Object reference not set to an instance of an object.", e.Message); } }