public async Task HomeController_GetAirports_Should_Return_Convenient_AirportsAsync(string searchKey) { var controller = new FlightController(_flightService.Object); var response = await controller.GetAirports(new AirportRequestDto() { SearchKey = searchKey }); var okResult = response as OkObjectResult; okResult.Should().NotBeNull(); ICollection <AirportResponseDto> respValue = okResult.Value as ICollection <AirportResponseDto>; respValue.Count.Should().Be(airports.Where(t => t.Code.ToLower().Contains(searchKey.ToLower()) || t.Name.ToLower().Contains(searchKey.ToLower())).ToList().Count); }