public void AircraftReportJson_Constructor_Initialises_To_Known_State_And_Properties_Work()
        {
            var json = new AircraftReportJson();

            TestUtilities.TestProperty(json, "Aircraft", null, new ReportAircraftJson());
            TestUtilities.TestProperty(json, "CountRows", null, 1);
            TestUtilities.TestProperty(json, "ErrorText", null, "Ab");
            TestUtilities.TestProperty(json, "GroupBy", null, "Ab");
            TestUtilities.TestProperty(json, "ProcessingTime", null, "Ab");

            Assert.AreEqual(0, json.Airports.Count);
            Assert.AreEqual(0, json.Flights.Count);
            Assert.AreEqual(0, json.Routes.Count);
        }
        /// <summary>
        /// Creates the JSON for a report that describes a single aircraft and the flights it has undertaken.
        /// </summary>
        /// <param name="args"></param>
        /// <param name="parameters"></param>
        /// <param name="findByIcao"></param>
        /// <returns></returns>
        private AircraftReportJson CreateSingleAircraftReport(RequestReceivedEventArgs args, Parameters parameters, bool findByIcao)
        {
            AircraftReportJson json = new AircraftReportJson() {
                CountRows = 0,
                GroupBy = "",
            };

            var aircraftIdentifier = findByIcao ? parameters.Icao : parameters.Registration;
            if(!String.IsNullOrEmpty(aircraftIdentifier)) {
                var aircraft = findByIcao ? BaseStationDatabase.GetAircraftByCode(aircraftIdentifier)
                                          : BaseStationDatabase.GetAircraftByRegistration(aircraftIdentifier);
                if(aircraft != null) {
                    // Remove all criteria that is used to identify an aircraft
                    parameters.Icao = null;
                    parameters.Registration = null;
                    parameters.Operator = null;
                    parameters.Country = null;

                    json.Aircraft = CreateReportAircraftJson(aircraft, args);

                    json.CountRows = BaseStationDatabase.GetCountOfFlightsForAircraft(aircraft, parameters);
                    var dbFlights = BaseStationDatabase.GetFlightsForAircraft(aircraft, parameters,
                        parameters.FromRow, parameters.ToRow,
                        parameters.SortField1, parameters.SortAscending1,
                        parameters.SortField2, parameters.SortAscending2);

                    TranscribeDatabaseRecordsToJson(dbFlights, json.Flights, null, json.Airports, json.Routes, args, parameters);
                }
            }

            if(json.Aircraft == null) {
                json.Aircraft = new ReportAircraftJson() {
                    IsUnknown = true,
                };
            }

            return json;
        }