예제 #1
0
        public async void DeleteReturnValidResponseIfDeliveryNotFoundTest()
        {
            var controller = new DeliveryController(deliveryService, mapper);
            var response   = await controller.Delete(-1);

            var notFoundResult = response as NotFoundObjectResult;

            Assert.NotNull(notFoundResult);
            Assert.Equal(404, notFoundResult.StatusCode);
        }
예제 #2
0
        public async void DeleteTest()
        {
            var controller = new DeliveryController(deliveryService, mapper);;
            var response   = await controller.Delete(1);

            var okResult = response as OkObjectResult;

            Assert.NotNull(okResult);
            Assert.Equal(200, okResult.StatusCode);
            Assert.NotNull(okResult.Value);

            var delivery = okResult.Value as Delivery;

            Assert.Equal(1, delivery.Id);
        }