public void ReportAircraftJson_Constructor_Initialises_To_Known_State_And_Properties_Work() { var json = new ReportAircraftJson(); TestUtilities.TestProperty(json, "AircraftClass", null, "Ab"); TestUtilities.TestProperty(json, "AircraftId", 0, 1); TestUtilities.TestProperty(json, "AirframeReg", null, "Ab"); TestUtilities.TestProperty(json, "CofACategory", null, "Ab"); TestUtilities.TestProperty(json, "CofAExpiry", null, "Ab"); TestUtilities.TestProperty(json, "Country", null, "Ab"); TestUtilities.TestProperty(json, "CurrentRegDate", null, "Ab"); TestUtilities.TestProperty(json, "DeRegDate", null, "Ab"); TestUtilities.TestProperty(json, "Engines", null, "Ab"); TestUtilities.TestProperty(json, "EngineType", null, 1); TestUtilities.TestProperty(json, "FirstRegDate", null, "Ab"); TestUtilities.TestProperty(json, "GenericName", null, "Ab"); TestUtilities.TestProperty(json, "HasPicture", false); TestUtilities.TestProperty(json, "Icao", null, "Ab"); TestUtilities.TestProperty(json, "IcaoTypeCode", null, "Ab"); TestUtilities.TestProperty(json, "InfoUrl", null, "Ab"); TestUtilities.TestProperty(json, "Interested", false); TestUtilities.TestProperty(json, "IsUnknown", false); TestUtilities.TestProperty(json, "Manufacturer", null, "Ab"); TestUtilities.TestProperty(json, "Military", false); TestUtilities.TestProperty(json, "ModeSCountry", null, "Ab"); TestUtilities.TestProperty(json, "MTOW", null, "Ab"); TestUtilities.TestProperty(json, "Notes", null, "Ab"); TestUtilities.TestProperty(json, "OperatorFlagCode", null, "Ab"); TestUtilities.TestProperty(json, "OwnershipStatus", null, "Ab"); TestUtilities.TestProperty(json, "PictureUrl1", null, "Ab"); TestUtilities.TestProperty(json, "PictureUrl2", null, "Ab"); TestUtilities.TestProperty(json, "PictureUrl3", null, "Ab"); TestUtilities.TestProperty(json, "PopularName", null, "Ab"); TestUtilities.TestProperty(json, "PreviousId", null, "Ab"); TestUtilities.TestProperty(json, "RegisteredOwners", null, "Ab"); TestUtilities.TestProperty(json, "Registration", null, "Ab"); TestUtilities.TestProperty(json, "SerialNumber", null, "Ab"); TestUtilities.TestProperty(json, "Species", null, 1); TestUtilities.TestProperty(json, "Status", null, "Ab"); TestUtilities.TestProperty(json, "TotalHours", null, "Ab"); TestUtilities.TestProperty(json, "Type", null, "Ab"); TestUtilities.TestProperty(json, "WakeTurbulenceCategory", null, 1); TestUtilities.TestProperty(json, "YearBuilt", null, "Ab"); }
/// <summary> /// Creates the JSON representation of an aircraft. /// </summary> /// <param name="aircraft"></param> /// <param name="args"></param> /// <returns></returns> private ReportAircraftJson CreateReportAircraftJson(BaseStationAircraft aircraft, RequestReceivedEventArgs args) { var result = new ReportAircraftJson() { AircraftClass = aircraft.AircraftClass, AircraftId = aircraft.AircraftID, CofACategory = aircraft.CofACategory, CofAExpiry = aircraft.CofAExpiry, Country = aircraft.Country, CurrentRegDate = aircraft.CurrentRegDate, DeRegDate = aircraft.DeRegDate, FirstRegDate = aircraft.FirstRegDate, GenericName = aircraft.GenericName, IcaoTypeCode = aircraft.ICAOTypeCode, InfoUrl = aircraft.InfoUrl, Manufacturer = aircraft.Manufacturer, Icao = aircraft.ModeS, ModeSCountry = aircraft.ModeSCountry, MTOW = aircraft.MTOW, OperatorFlagCode = aircraft.OperatorFlagCode, OwnershipStatus = aircraft.OwnershipStatus, PictureUrl1 = aircraft.PictureUrl1, PictureUrl2 = aircraft.PictureUrl2, PictureUrl3 = aircraft.PictureUrl3, PopularName = aircraft.PopularName, PreviousId = aircraft.PreviousID, Registration = aircraft.Registration, RegisteredOwners = aircraft.RegisteredOwners, SerialNumber = aircraft.SerialNo, Status = aircraft.Status, TotalHours = aircraft.TotalHours, Type = aircraft.Type, Notes = aircraft.UserNotes, YearBuilt = aircraft.YearBuilt, HasPicture = args.IsInternetRequest && !_InternetClientCanSeePictures ? false : _PictureManager.FindPicture(_PictureFolderCache, aircraft.ModeS, aircraft.Registration) != null, }; var aircraftType = String.IsNullOrEmpty(aircraft.ICAOTypeCode) ? null : StandingDataManager.FindAircraftType(aircraft.ICAOTypeCode); if(aircraftType != null) { result.WakeTurbulenceCategory = (int)aircraftType.WakeTurbulenceCategory; result.Engines = aircraftType.Engines; result.EngineType = (int)aircraftType.EngineType; result.Species = (int)aircraftType.Species; } var codeBlock = String.IsNullOrEmpty(aircraft.ModeS) ? null : StandingDataManager.FindCodeBlock(aircraft.ModeS); if(codeBlock != null) result.Military = codeBlock.IsMilitary; return result; }