public void GetTicketType_ReturnNotNullList() { var mock = new Mock <passenger>(sysdb); PassengerController obj = new PassengerController(mock.Object); var data = obj.GetTicketType(); var res = data as ObjectResult; Assert.IsNotNull(data); }
public void GetTicketType_ValidInput_OkRequest() { var mock = new Mock <passenger>(sysdb); PassengerController obj = new PassengerController(mock.Object); var data = obj.GetTicketType(); var res = data as ObjectResult; Assert.AreEqual(200, res.StatusCode); }
public void GetTicketType_InvalidInput_ReturnsBadRequest() { try { var mock = new Mock <passenger>(sysdb); PassengerController obj = new PassengerController(mock.Object); var data = obj.GetTicketType(); 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); } }