public void GetBookingDetail_ReturnNotNullList() { var mock = new Mock <passenger>(sysdb); PassengerController obj = new PassengerController(mock.Object); var data = obj.GetBookingDetail(2224); var res = data as ObjectResult; Assert.IsNotNull(data); }
public void GetBookingDetail_ValidInput_OkRequest() { var mock = new Mock <passenger>(sysdb); PassengerController obj = new PassengerController(mock.Object); var data = obj.GetBookingDetail(2222); var res = data as ObjectResult; Assert.AreEqual(200, res.StatusCode); }
public void GetBookingDetail_InvalidInput_ReturnsBadRequest() { try { var mock = new Mock <passenger>(sysdb); PassengerController obj = new PassengerController(mock.Object); var data = obj.GetBookingDetail(6666); var res = data as BadRequestResult; Assert.AreEqual(400, res.StatusCode); } catch (Exception e) { Assert.AreEqual("Object reference not set to an instance of an object.", e.Message); } }