Beispiel #1
0
        public async Task PostAsyncWithValidationErrorsReturnsBadRequest()
        {
            // Arrange
            var newBooking = new NewBookingViewModel()
            {
                PassengersName = "PersonName"
            };

            _controller.ModelState.AddModelError("FlightNumber", "The FlightNumber field is required.");

            // Act
            var result = await _controller.PostAsync(newBooking);

            // Assert
            Assert.IsType <BadRequestObjectResult>(result);
        }