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