Пример #1
0
        public async Task DeleteTravelAsync_Return_NoContent_Result(Mock <ITravelService> travelService)
        {
            var sut = new TravelController(travelService.Object);

            sut.ControllerContext = new ControllerContext
            {
                HttpContext = new DefaultHttpContext()
            };

            travelService.Setup(setup => setup.DeleteTravelAsync(travelId));

            // Act
            var result = sut.DeleteTravelAsync(travelId);

            // Assert

            Assert.IsType <NoContentResult>(result.Result);
            Assert.IsNotType <OkObjectResult>(result.Result);
            Assert.IsNotType <CreatedAtActionResult>(result.Result);
            Assert.IsNotType <BadRequestObjectResult>(result.Result);
            Assert.IsNotType <AcceptedAtActionResult>(result.Result);
        }