예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
            }
        }