diff --git a/README.md b/README.md index 7bc24abf..cfc06a79 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,7 @@ Valid keys in each airports object are as follows: "basic": {}, "fixes": {}, "freetext": {}, + "ground_network": {}, "ownership": {}, "positions": {}, "positions_mentor": {}, diff --git a/src/Compiler/Collector/CompilableElementCollectorFactory.cs b/src/Compiler/Collector/CompilableElementCollectorFactory.cs index f4b9e037..4dbd8730 100644 --- a/src/Compiler/Collector/CompilableElementCollectorFactory.cs +++ b/src/Compiler/Collector/CompilableElementCollectorFactory.cs @@ -22,31 +22,32 @@ public ICompilableElementCollector GetCollectorForOutputSection(OutputSectionKey return section switch { // Headers - OutputSectionKeys.FILE_HEADER => new HeaderCollector(this.sectorElements), + OutputSectionKeys.FILE_HEADER => new HeaderCollector(sectorElements), // SCT Sections - OutputSectionKeys.SCT_COLOUR_DEFS => new ColoursCollector(this.sectorElements), - OutputSectionKeys.SCT_INFO => new InfoCollector(this.sectorElements), - OutputSectionKeys.SCT_AIRPORT => new AirportsCollector(this.sectorElements), - OutputSectionKeys.SCT_RUNWAY => new RunwaysCollector(this.sectorElements), - OutputSectionKeys.SCT_VOR => new VorsCollector(this.sectorElements), - OutputSectionKeys.SCT_NDB => new NdbsCollector(this.sectorElements), - OutputSectionKeys.SCT_FIXES => new FixesCollector(this.sectorElements), - OutputSectionKeys.SCT_GEO => new GeoCollector(this.sectorElements, this.outputGroups), - OutputSectionKeys.SCT_LOW_AIRWAY => new LowAirwaysCollector(this.sectorElements), - OutputSectionKeys.SCT_HIGH_AIRWAY => new HighAirwaysCollector(this.sectorElements), - OutputSectionKeys.SCT_ARTCC => new ArtccCollector(this.sectorElements), - OutputSectionKeys.SCT_ARTCC_LOW => new LowArtccCollector(this.sectorElements), - OutputSectionKeys.SCT_ARTCC_HIGH => new HighArtccCollector(this.sectorElements), - OutputSectionKeys.SCT_SID => new SidsCollector(this.sectorElements, this.outputGroups), - OutputSectionKeys.SCT_STAR => new StarsCollector(this.sectorElements, this.outputGroups), - OutputSectionKeys.SCT_LABELS => new LabelsCollector(this.sectorElements, this.outputGroups), - OutputSectionKeys.SCT_REGIONS => new RegionsCollector(this.sectorElements, this.outputGroups), + OutputSectionKeys.SCT_COLOUR_DEFS => new ColoursCollector(sectorElements), + OutputSectionKeys.SCT_INFO => new InfoCollector(sectorElements), + OutputSectionKeys.SCT_AIRPORT => new AirportsCollector(sectorElements), + OutputSectionKeys.SCT_RUNWAY => new RunwaysCollector(sectorElements), + OutputSectionKeys.SCT_VOR => new VorsCollector(sectorElements), + OutputSectionKeys.SCT_NDB => new NdbsCollector(sectorElements), + OutputSectionKeys.SCT_FIXES => new FixesCollector(sectorElements), + OutputSectionKeys.SCT_GEO => new GeoCollector(sectorElements, outputGroups), + OutputSectionKeys.SCT_LOW_AIRWAY => new LowAirwaysCollector(sectorElements), + OutputSectionKeys.SCT_HIGH_AIRWAY => new HighAirwaysCollector(sectorElements), + OutputSectionKeys.SCT_ARTCC => new ArtccCollector(sectorElements), + OutputSectionKeys.SCT_ARTCC_LOW => new LowArtccCollector(sectorElements), + OutputSectionKeys.SCT_ARTCC_HIGH => new HighArtccCollector(sectorElements), + OutputSectionKeys.SCT_SID => new SidsCollector(sectorElements, outputGroups), + OutputSectionKeys.SCT_STAR => new StarsCollector(sectorElements, outputGroups), + OutputSectionKeys.SCT_LABELS => new LabelsCollector(sectorElements, outputGroups), + OutputSectionKeys.SCT_REGIONS => new RegionsCollector(sectorElements, outputGroups), // ESE sections. - OutputSectionKeys.ESE_POSITIONS => new PositionsCollector(this.sectorElements, this.outputGroups), - OutputSectionKeys.ESE_FREETEXT => new FreetextCollector(this.sectorElements, this.outputGroups), - OutputSectionKeys.ESE_SIDSSTARS => new SidStarsCollector(this.sectorElements), - OutputSectionKeys.ESE_AIRSPACE => new AirspaceCollector(this.sectorElements, this.outputGroups), - OutputSectionKeys.RWY_ACTIVE_RUNWAYS => new ActiveRunwaysCollector(this.sectorElements), + OutputSectionKeys.ESE_POSITIONS => new PositionsCollector(sectorElements, outputGroups), + OutputSectionKeys.ESE_FREETEXT => new FreetextCollector(sectorElements, outputGroups), + OutputSectionKeys.ESE_SIDSSTARS => new SidStarsCollector(sectorElements), + OutputSectionKeys.ESE_AIRSPACE => new AirspaceCollector(sectorElements, outputGroups), + OutputSectionKeys.ESE_GROUND_NETWORK => new GroundNetworkCollector(sectorElements), + OutputSectionKeys.RWY_ACTIVE_RUNWAYS => new ActiveRunwaysCollector(sectorElements), _ => throw new ArgumentException("No element collector for section " + section) }; } diff --git a/src/Compiler/Collector/GroundNetworkCollector.cs b/src/Compiler/Collector/GroundNetworkCollector.cs new file mode 100644 index 00000000..96a3393e --- /dev/null +++ b/src/Compiler/Collector/GroundNetworkCollector.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using System.Linq; +using Compiler.Model; + +namespace Compiler.Collector +{ + public class GroundNetworkCollector : ICompilableElementCollector + { + private readonly SectorElementCollection sectorElements; + + public GroundNetworkCollector(SectorElementCollection sectorElements) + { + this.sectorElements = sectorElements; + } + + public IEnumerable GetCompilableElements() + { + return sectorElements.GroundNetworks.OrderBy(network => network.Airport); + } + } +} \ No newline at end of file diff --git a/src/Compiler/Config/AirfieldConfigFileSections.cs b/src/Compiler/Config/AirfieldConfigFileSections.cs index 51b4a706..8868de0d 100644 --- a/src/Compiler/Config/AirfieldConfigFileSections.cs +++ b/src/Compiler/Config/AirfieldConfigFileSections.cs @@ -29,6 +29,7 @@ public class AirfieldConfigFileSections new ConfigFileSection("ground_map.regions", InputDataType.SCT_REGIONS, "Ground Map Regions"), new ConfigFileSection("ground_map.labels", InputDataType.SCT_LABELS, "Ground Map Labels"), new ConfigFileSection("vrps", InputDataType.ESE_VRPS, "VRPs"), + new ConfigFileSection("ground_network", InputDataType.ESE_GROUND_NETWORK, "Ground Network"), }; } } diff --git a/src/Compiler/Input/InputDataType.cs b/src/Compiler/Input/InputDataType.cs index 2bccfe12..8ec2b28f 100644 --- a/src/Compiler/Input/InputDataType.cs +++ b/src/Compiler/Input/InputDataType.cs @@ -37,6 +37,7 @@ public enum InputDataType ESE_SIDS, ESE_STARS, ESE_VRPS, + ESE_GROUND_NETWORK, // EuroScope RWY file RWY_ACTIVE_RUNWAY, diff --git a/src/Compiler/Input/SectorDataReaderFactory.cs b/src/Compiler/Input/SectorDataReaderFactory.cs index 6311a5e8..6f1b2d14 100644 --- a/src/Compiler/Input/SectorDataReaderFactory.cs +++ b/src/Compiler/Input/SectorDataReaderFactory.cs @@ -10,6 +10,7 @@ public static AbstractSectorDataReader Create(InputDataType dataType) { InputDataType.ESE_AGREEMENTS => new EseSectorDataReader(), InputDataType.ESE_FREETEXT => new EseSectorDataReader(), + InputDataType.ESE_GROUND_NETWORK => new EseSectorDataReader(), InputDataType.ESE_POSITIONS_MENTOR => new EseSectorDataReader(), InputDataType.ESE_OWNERSHIP => new EseSectorDataReader(), InputDataType.ESE_POSITIONS => new EseSectorDataReader(), diff --git a/src/Compiler/Model/GroundNetwork.cs b/src/Compiler/Model/GroundNetwork.cs new file mode 100644 index 00000000..a8e35253 --- /dev/null +++ b/src/Compiler/Model/GroundNetwork.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Compiler.Model +{ + /** + * Container for all the ground network elements related to an airport + */ + public class GroundNetwork: ICompilableElementProvider + { + public string Airport { get; } + public List Taxiways { get; } + public List RunwayExits { get; } + + public GroundNetwork( + string airport, + List taxiways, + List runwayExits + ) + { + Airport = airport; + Taxiways = taxiways; + RunwayExits = runwayExits; + } + + public IEnumerable GetCompilableElements() + { + return Taxiways.Concat(RunwayExits); + } + } +} \ No newline at end of file diff --git a/src/Compiler/Model/GroundNetworkCoordinate.cs b/src/Compiler/Model/GroundNetworkCoordinate.cs new file mode 100644 index 00000000..d03b6c0a --- /dev/null +++ b/src/Compiler/Model/GroundNetworkCoordinate.cs @@ -0,0 +1,22 @@ +namespace Compiler.Model +{ + public class GroundNetworkCoordinate: AbstractCompilableElement + { + public Coordinate Coordinate { get; } + + public GroundNetworkCoordinate( + Coordinate coordinate, + Definition definition, + Docblock docblock, + Comment inlineComment + ) : base(definition, docblock, inlineComment) + { + Coordinate = coordinate; + } + + public override string GetCompileData(SectorElementCollection elements) + { + return $"COORD:{Coordinate.latitude}:{Coordinate.longitude}"; + } + } +} \ No newline at end of file diff --git a/src/Compiler/Model/GroundNetworkRunwayExit.cs b/src/Compiler/Model/GroundNetworkRunwayExit.cs new file mode 100644 index 00000000..96031b87 --- /dev/null +++ b/src/Compiler/Model/GroundNetworkRunwayExit.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Compiler.Model +{ + public class GroundNetworkRunwayExit: AbstractCompilableElement + { + public string Runway { get; } + public string ExitName { get; } + public string Direction { get; } + public List Coordinates { get; } + public int MaximumSpeed { get; } + + public GroundNetworkRunwayExit( + string runway, + string exitName, + string direction, + int maximumSpeed, + List coordinates, + Definition definition, + Docblock docblock, + Comment inlineComment + ) : base(definition, docblock, inlineComment) + { + Runway = runway; + ExitName = exitName; + Direction = direction; + Coordinates = coordinates; + MaximumSpeed = maximumSpeed; + } + + public override IEnumerable GetCompilableElements() + { + return new List {this} + .Concat(this.Coordinates); + } + + public override string GetCompileData(SectorElementCollection elements) + { + return $"EXIT:{Runway}:{ExitName}:{Direction}:{MaximumSpeed}"; + } + } +} \ No newline at end of file diff --git a/src/Compiler/Model/GroundNetworkTaxiway.cs b/src/Compiler/Model/GroundNetworkTaxiway.cs new file mode 100644 index 00000000..a818a738 --- /dev/null +++ b/src/Compiler/Model/GroundNetworkTaxiway.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Compiler.Model +{ + public class GroundNetworkTaxiway: AbstractCompilableElement + { + public string Name { get; } + public List Coordinates { get; } + public int MaximumSpeed { get; } + public int? UsageFlag { get; } + public string GateName { get; } + + public GroundNetworkTaxiway( + string name, + int maximumSpeed, + int? usageFlag, + string gateName, + List coordinates, + Definition definition, + Docblock docblock, + Comment inlineComment + ) : base(definition, docblock, inlineComment) + { + Name = name; + Coordinates = coordinates; + MaximumSpeed = maximumSpeed; + UsageFlag = usageFlag; + GateName = gateName; + } + + public override IEnumerable GetCompilableElements() + { + return new List {this} + .Concat(this.Coordinates); + } + + public override string GetCompileData(SectorElementCollection elements) + { + return $"TAXI:{Name}:{MaximumSpeed}:{UsageFlag}:{GateName}"; + } + } +} \ No newline at end of file diff --git a/src/Compiler/Model/SectorElementCollection.cs b/src/Compiler/Model/SectorElementCollection.cs index 87c15f9e..01cc72e2 100644 --- a/src/Compiler/Model/SectorElementCollection.cs +++ b/src/Compiler/Model/SectorElementCollection.cs @@ -49,6 +49,8 @@ public class SectorElementCollection public List RunwayCentrelines { get; } = new(); public List FixedColourRunwayCentrelines { get; } = new(); + + public List GroundNetworks { get; } = new(); public void Add(Airport airport) { @@ -197,5 +199,10 @@ public void Add(FixedColourRunwayCentreline centreline) { FixedColourRunwayCentrelines.Add(centreline); } + + public void Add(GroundNetwork network) + { + GroundNetworks.Add(network); + } } } diff --git a/src/Compiler/Output/EseOutput.cs b/src/Compiler/Output/EseOutput.cs index cb6da281..90c57cf9 100644 --- a/src/Compiler/Output/EseOutput.cs +++ b/src/Compiler/Output/EseOutput.cs @@ -15,6 +15,7 @@ public override OutputSectionKeys[] GetOutputSections() OutputSectionKeys.ESE_FREETEXT, OutputSectionKeys.ESE_SIDSSTARS, OutputSectionKeys.ESE_AIRSPACE, + OutputSectionKeys.ESE_GROUND_NETWORK }; } diff --git a/src/Compiler/Output/OutputSectionKeys.cs b/src/Compiler/Output/OutputSectionKeys.cs index 247dd311..bde79a28 100644 --- a/src/Compiler/Output/OutputSectionKeys.cs +++ b/src/Compiler/Output/OutputSectionKeys.cs @@ -29,6 +29,7 @@ public enum OutputSectionKeys ESE_FREETEXT, ESE_SIDSSTARS, ESE_AIRSPACE, + ESE_GROUND_NETWORK, // RWY RWY_ACTIVE_RUNWAYS diff --git a/src/Compiler/Output/OutputSectionsConfig.cs b/src/Compiler/Output/OutputSectionsConfig.cs index 53c687cc..e0defd01 100644 --- a/src/Compiler/Output/OutputSectionsConfig.cs +++ b/src/Compiler/Output/OutputSectionsConfig.cs @@ -114,6 +114,11 @@ public class OutputSectionsConfig true, "[AIRSPACE]" ), + new( + OutputSectionKeys.ESE_GROUND_NETWORK, + true, + "[GROUND]" + ), new( OutputSectionKeys.RWY_ACTIVE_RUNWAYS, false, diff --git a/src/Compiler/Parser/DataParserFactory.cs b/src/Compiler/Parser/DataParserFactory.cs index 7b9280a7..bae1fdf3 100644 --- a/src/Compiler/Parser/DataParserFactory.cs +++ b/src/Compiler/Parser/DataParserFactory.cs @@ -69,6 +69,7 @@ public ISectorDataParser GetParserForFile(AbstractSectorDataFile file) PositionOrder.PRE_POSITION ), InputDataType.ESE_VRPS => new VrpParser(sectorElements, logger), + InputDataType.ESE_GROUND_NETWORK => new GroundNetworkParser(sectorElements, logger), _ => throw new NotImplementedException( $"Parser not not implemented for input data type {file.DataType.ToString()}") }; diff --git a/src/Compiler/Parser/GroundNetworkParser.cs b/src/Compiler/Parser/GroundNetworkParser.cs new file mode 100644 index 00000000..99e5d1b7 --- /dev/null +++ b/src/Compiler/Parser/GroundNetworkParser.cs @@ -0,0 +1,277 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Compiler.Error; +using Compiler.Event; +using Compiler.Input; +using Compiler.Model; +using Compiler.Validate; + +namespace Compiler.Parser +{ + public class GroundNetworkParser: ISectorDataParser + { + private const string TaxiDeclaration = "TAXI"; + private const string ExitDeclaration = "EXIT"; + private SectorElementCollection sectorElements; + private IEventLogger errorLog; + + public GroundNetworkParser( + SectorElementCollection sectorElements, + IEventLogger errorLog + ) { + this.sectorElements = sectorElements; + this.errorLog = errorLog; + } + + public void ParseData(AbstractSectorDataFile data) + { + bool doneFirstLine = false; + List lines = new(); + List taxiways = new(); + List exits = new(); + foreach (SectorData line in data) + { + if (!doneFirstLine) + { + lines.Add(line); + doneFirstLine = true; + } + else if (IsNewDeclaration(line)) + { + try + { + ProcessLines(data, lines, taxiways, exits); + } + catch + { + return; + } + lines.Clear(); + lines.Add(line); + } else + { + lines.Add(line); + } + } + + if (lines.Any()) + { + try + { + ProcessLines(data, lines, taxiways, exits); + } + catch + { + return; + } + } + + sectorElements.Add( + new GroundNetwork( + data.GetParentDirectoryName(), + taxiways, + exits + ) + ); + } + + private void ProcessLines( + AbstractSectorDataFile file, + List lines, + List taxiways, + List exits + ) { + switch (lines[0].dataSegments[0]) + { + case TaxiDeclaration: + taxiways.Add(ProcessTaxiway(file, lines)); + break; + case ExitDeclaration: + exits.Add(ProcessExit(file, lines)); + break; + default: + errorLog.AddEvent(new SyntaxError("Unknown ground network declaration type", lines[0])); + throw new ArgumentException(); + } + } + + private GroundNetworkTaxiway ProcessTaxiway(AbstractSectorDataFile file, List lines) + { + SectorData declarationLine = lines[0]; + if (declarationLine.dataSegments.Count < 3 || declarationLine.dataSegments.Count > 5) + { + errorLog.AddEvent( + new SyntaxError("Invalid number of TAXI declaration segments", declarationLine) + ); + throw new ArgumentException(); + } + + if ( + !int.TryParse(declarationLine.dataSegments[2], out int maximumSpeed) || + maximumSpeed < 1 + ) { + errorLog.AddEvent( + new SyntaxError("Invalid maximum speed in TAXI declaration", declarationLine) + ); + throw new ArgumentException(); + } + + + int? usageFlag = null; + if ( + declarationLine.dataSegments.Count >= 4 && + declarationLine.dataSegments[3] != "" + ) { + + if ( + !int.TryParse(declarationLine.dataSegments[3], out int parsedUsageFlag) || + parsedUsageFlag < 1 || + parsedUsageFlag > 3 + ) { + errorLog.AddEvent( + new SyntaxError("Invalid usage flag in TAXI declaration", declarationLine) + ); + throw new ArgumentException(); + } + + usageFlag = parsedUsageFlag; + } + + string gateName = declarationLine.dataSegments.Count == 5 + ? (declarationLine.dataSegments[4] == "" ? null : declarationLine.dataSegments[4]) + : null; + + return new GroundNetworkTaxiway( + declarationLine.dataSegments[1], + maximumSpeed, + usageFlag, + gateName, + ProcessCoordinates(file, lines.GetRange(1, lines.Count - 1), TaxiDeclaration), + declarationLine.definition, + declarationLine.docblock, + declarationLine.inlineComment + ); + } + + private GroundNetworkRunwayExit ProcessExit(AbstractSectorDataFile file, List lines) + { + SectorData declarationLine = lines[0]; + if (declarationLine.dataSegments.Count != 5) + { + errorLog.AddEvent( + new SyntaxError("Invalid number of EXIT declaration segments", declarationLine) + ); + throw new ArgumentException(); + } + + if (!RunwayValidator.RunwayValid(declarationLine.dataSegments[1])) + { + errorLog.AddEvent( + new SyntaxError("Invalid runway in EXIT declaration", declarationLine) + ); + throw new ArgumentException(); + } + + if (declarationLine.dataSegments[3] != "LEFT" && declarationLine.dataSegments[3] != "RIGHT") + { + errorLog.AddEvent( + new SyntaxError( + "Invalid exit direction in EXIT declaration, must be LEFT or RIGHT", + declarationLine + ) + ); + throw new ArgumentException(); + } + + if ( + !int.TryParse(declarationLine.dataSegments[4], out int maximumSpeed) || + maximumSpeed < 1 + ) { + errorLog.AddEvent( + new SyntaxError("Invalid maximum speed in EXIT declaration", declarationLine) + ); + throw new ArgumentException(); + } + + return new GroundNetworkRunwayExit( + declarationLine.dataSegments[1], + declarationLine.dataSegments[2], + declarationLine.dataSegments[3], + maximumSpeed, + ProcessCoordinates(file, lines.GetRange(1, lines.Count - 1), ExitDeclaration), + declarationLine.definition, + declarationLine.docblock, + declarationLine.inlineComment + ); + } + + private List ProcessCoordinates( + AbstractSectorDataFile file, + List lines, + string parentElementType + ) { + if (lines.Count == 0) + { + errorLog.AddEvent( + new SyntaxError( + $"All ground network {parentElementType} declarations must have at least one coordinate", + file.GetFileName() + ) + ); + throw new ArgumentException(); + } + + List coordinates = new(); + for (int i = 0; i < lines.Count; i++) + { + SectorData line = lines[i]; + if (line.dataSegments.Count != 3) + { + errorLog.AddEvent( + new SyntaxError($"Invalid number of {parentElementType} COORD segments", lines[i]) + ); + throw new ArgumentException(); + } + + if (line.dataSegments[0] != "COORD") + { + errorLog.AddEvent( + new SyntaxError($"Invalid COORD in {parentElementType} declaration", lines[i]) + ); + throw new ArgumentException(); + } + + if ( + !CoordinateParser.TryParse( + line.dataSegments[1], + line.dataSegments[2], + out Coordinate parsedCoordinate + ) + ) { + errorLog.AddEvent( + new SyntaxError($"Invalid coordinate in {parentElementType} declaration", lines[i]) + ); + throw new ArgumentException(); + } + + coordinates.Add( + new GroundNetworkCoordinate( + parsedCoordinate, + line.definition, + line.docblock, + line.inlineComment + ) + ); + } + + return coordinates; + } + + private bool IsNewDeclaration(SectorData line) + { + return line.dataSegments[0] == TaxiDeclaration || + line.dataSegments[0] == ExitDeclaration; + } + } +} \ No newline at end of file diff --git a/src/Compiler/Parser/HeadingParser.cs b/src/Compiler/Parser/HeadingParser.cs new file mode 100644 index 00000000..6b2dd9cc --- /dev/null +++ b/src/Compiler/Parser/HeadingParser.cs @@ -0,0 +1,21 @@ +namespace Compiler.Parser +{ + public static class HeadingParser + { + public static bool TryParse(string heading, out int parsedHeading) + { + if ( + int.TryParse(heading, out int headingInt) && + headingInt <= 360 && + headingInt > 0 + ) + { + parsedHeading = headingInt; + return true; + } + + parsedHeading = -1; + return false; + } + } +} \ No newline at end of file diff --git a/src/Compiler/Validate/AirportValidator.cs b/src/Compiler/Validate/AirportValidator.cs index 823ea9ed..12b91dd6 100644 --- a/src/Compiler/Validate/AirportValidator.cs +++ b/src/Compiler/Validate/AirportValidator.cs @@ -12,7 +12,7 @@ public class AirportValidator public static bool IcaoValid(string code) { - return Regex.IsMatch(code, AirportValidator.IcaoRegex); + return Regex.IsMatch(code, IcaoRegex); } /* @@ -20,8 +20,8 @@ public static bool IcaoValid(string code) */ public static bool ValidEuroscopeAirport(string code) { - return code == AirportValidator.AnyAirportString || - Regex.IsMatch(code, AirportValidator.IcaoRegex); + return code == AnyAirportString || + Regex.IsMatch(code, IcaoRegex); } /* @@ -29,8 +29,8 @@ public static bool ValidEuroscopeAirport(string code) */ public static bool ValidSectorGuestAirport(string code) { - return code == AirportValidator.GuestAirportString || - Regex.IsMatch(code, AirportValidator.IcaoRegex); + return code == GuestAirportString || + Regex.IsMatch(code, IcaoRegex); } } } diff --git a/src/Compiler/Validate/AllAirwaysMustHaveValidPoints.cs b/src/Compiler/Validate/AllAirwaysMustHaveValidPoints.cs index 7e23abf6..f1242f8a 100644 --- a/src/Compiler/Validate/AllAirwaysMustHaveValidPoints.cs +++ b/src/Compiler/Validate/AllAirwaysMustHaveValidPoints.cs @@ -10,8 +10,8 @@ public class AllAirwaysMustHaveValidPoints : IValidationRule { public void Validate(SectorElementCollection sectorElements, CompilerArguments args, IEventLogger events) { - this.TestAirwayCategory(sectorElements.LowAirways, sectorElements, events); - this.TestAirwayCategory(sectorElements.HighAirways, sectorElements, events); + TestAirwayCategory(sectorElements.LowAirways, sectorElements, events); + TestAirwayCategory(sectorElements.HighAirways, sectorElements, events); } private void TestAirwayCategory( @@ -23,7 +23,7 @@ IEventLogger events { if (airway.StartPoint.Type() == Point.TypeIdentifier) { - if (this.InvalidPoint(airway.StartPoint.Identifier, sectorElements)) + if (InvalidPoint(airway.StartPoint.Identifier, sectorElements)) { string message = $"Invalid end point {airway.StartPoint.Identifier} on Airway segment for {airway.Identifier}"; @@ -35,7 +35,7 @@ IEventLogger events if (airway.EndPoint.Type() == Point.TypeIdentifier) { - if (this.InvalidPoint(airway.EndPoint.Identifier, sectorElements)) + if (InvalidPoint(airway.EndPoint.Identifier, sectorElements)) { string message = $"Invalid start point {airway.EndPoint.Identifier} on Airway segment for {airway.Identifier}"; @@ -49,10 +49,10 @@ IEventLogger events private bool InvalidPoint(string identifier, SectorElementCollection sectorElements) { - return !this.FindFixByIdentifier(identifier, sectorElements) && - !this.FindVorByIdentifier(identifier, sectorElements) && - !this.FindNdbByIdentifier(identifier, sectorElements) && - !this.FindAirportByIdentifier(identifier, sectorElements); + return !FindFixByIdentifier(identifier, sectorElements) && + !FindVorByIdentifier(identifier, sectorElements) && + !FindNdbByIdentifier(identifier, sectorElements) && + !FindAirportByIdentifier(identifier, sectorElements); } private bool FindVorByIdentifier(string identifier, SectorElementCollection sectorElements) diff --git a/src/Compiler/Validate/AllArtccsMustHaveValidPoints.cs b/src/Compiler/Validate/AllArtccsMustHaveValidPoints.cs index 55c3a313..c7689b50 100644 --- a/src/Compiler/Validate/AllArtccsMustHaveValidPoints.cs +++ b/src/Compiler/Validate/AllArtccsMustHaveValidPoints.cs @@ -10,9 +10,9 @@ public class AllArtccsMustHaveValidPoints : IValidationRule { public void Validate(SectorElementCollection sectorElements, CompilerArguments args, IEventLogger events) { - this.TestArtccCategory(sectorElements.Artccs, sectorElements, events); - this.TestArtccCategory(sectorElements.LowArtccs, sectorElements, events); - this.TestArtccCategory(sectorElements.HighArtccs, sectorElements, events); + TestArtccCategory(sectorElements.Artccs, sectorElements, events); + TestArtccCategory(sectorElements.LowArtccs, sectorElements, events); + TestArtccCategory(sectorElements.HighArtccs, sectorElements, events); } private void TestArtccCategory( @@ -24,7 +24,7 @@ IEventLogger events { if (artcc.StartPoint.Type() == Point.TypeIdentifier) { - if (this.InvalidPoint(artcc.StartPoint.Identifier, sectorElements)) + if (InvalidPoint(artcc.StartPoint.Identifier, sectorElements)) { string message = $"Invalid end point {artcc.StartPoint.Identifier} on ARTCC segment for {artcc.Identifier}"; @@ -36,7 +36,7 @@ IEventLogger events if (artcc.EndPoint.Type() == Point.TypeIdentifier) { - if (this.InvalidPoint(artcc.EndPoint.Identifier, sectorElements)) + if (InvalidPoint(artcc.EndPoint.Identifier, sectorElements)) { string message = $"Invalid start point {artcc.EndPoint.Identifier} on ARTCC segment for {artcc.Identifier}"; @@ -50,10 +50,10 @@ IEventLogger events private bool InvalidPoint(string identifier, SectorElementCollection sectorElements) { - return !this.FindFixByIdentifier(identifier, sectorElements) && - !this.FindVorByIdentifier(identifier, sectorElements) && - !this.FindNdbByIdentifier(identifier, sectorElements) && - !this.FindAirportByIdentifier(identifier, sectorElements); + return !FindFixByIdentifier(identifier, sectorElements) && + !FindVorByIdentifier(identifier, sectorElements) && + !FindNdbByIdentifier(identifier, sectorElements) && + !FindAirportByIdentifier(identifier, sectorElements); } private bool FindVorByIdentifier(string identifier, SectorElementCollection sectorElements) diff --git a/src/Compiler/Validate/AllRegionsMustHaveValidPoints.cs b/src/Compiler/Validate/AllRegionsMustHaveValidPoints.cs index 9af53b2c..0585de18 100644 --- a/src/Compiler/Validate/AllRegionsMustHaveValidPoints.cs +++ b/src/Compiler/Validate/AllRegionsMustHaveValidPoints.cs @@ -13,7 +13,7 @@ public void Validate(SectorElementCollection sectorElements, CompilerArguments a { foreach (RegionPoint point in region.Points) { - this.CheckPoint(point, region, sectorElements, events); + CheckPoint(point, region, sectorElements, events); } } } diff --git a/src/Compiler/Validate/AllRunwayExitsMustHaveAValidRunway.cs b/src/Compiler/Validate/AllRunwayExitsMustHaveAValidRunway.cs new file mode 100644 index 00000000..d98156da --- /dev/null +++ b/src/Compiler/Validate/AllRunwayExitsMustHaveAValidRunway.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using Compiler.Event; +using Compiler.Model; +using Compiler.Error; +using Compiler.Argument; +using System.Linq; + +namespace Compiler.Validate +{ + public class AllRunwayExitsMustHaveAValidRunway : IValidationRule + { + public void Validate(SectorElementCollection sectorElements, CompilerArguments args, IEventLogger events) + { + foreach (GroundNetwork groundNetwork in sectorElements.GroundNetworks) + { + foreach (GroundNetworkRunwayExit exit in groundNetwork.RunwayExits) + { + if (!RunwayValid(sectorElements, exit.Runway, groundNetwork.Airport)) + { + string message = $"Invalid ground network runway {groundNetwork.Airport}/{exit.Runway}"; + events.AddEvent(new ValidationRuleFailure(message, exit)); + break; + } + } + } + } + + private bool RunwayValid(SectorElementCollection sectorElements, string runwayIdentifier, string airportCode) + { + List airport = sectorElements.Airports.Where(airportElement => airportElement.Icao == airportCode).ToList(); + + return airport.Count != 0 && sectorElements.Runways + .Where(runway => runway.AirfieldIcao == airport[0].Icao) + .Where(runway => runway.FirstIdentifier == runwayIdentifier || runway.ReverseIdentifier == runwayIdentifier) + .ToList() + .Count() != 0; + } + } +} diff --git a/src/Compiler/Validate/AllSectorsMustHaveValidActiveRunway.cs b/src/Compiler/Validate/AllSectorsMustHaveValidActiveRunway.cs index fa9b388a..42dafffe 100644 --- a/src/Compiler/Validate/AllSectorsMustHaveValidActiveRunway.cs +++ b/src/Compiler/Validate/AllSectorsMustHaveValidActiveRunway.cs @@ -15,9 +15,8 @@ public void Validate(SectorElementCollection sectorElements, CompilerArguments a { foreach (SectorActive active in sector.Active) { - if (!this.RunwayValid(sectorElements, active.Runway, active.Airfield)) + if (!RunwayValid(sectorElements, active.Runway, active.Airfield)) { - this.RunwayValid(sectorElements, active.Runway, active.Airfield); string message = $"Invalid ACTIVE runway {active.Airfield}/{active.Runway} on sector {sector.Name}"; events.AddEvent(new ValidationRuleFailure(message, active)); diff --git a/src/Compiler/Validate/AllSidsMustBeUnique.cs b/src/Compiler/Validate/AllSidsMustBeUnique.cs index 5b576018..e744bf4f 100644 --- a/src/Compiler/Validate/AllSidsMustBeUnique.cs +++ b/src/Compiler/Validate/AllSidsMustBeUnique.cs @@ -14,7 +14,7 @@ public void Validate(SectorElementCollection sectorElements, CompilerArguments a List keys = new List(); foreach (SidStar sidStar in sectorElements.SidStars) { - string sidStarKey = this.GetKey(sidStar); + string sidStarKey = GetKey(sidStar); if (keys.Contains(sidStarKey)) { events.AddEvent(new ValidationRuleFailure("Duplicate SID/STAR " + sidStarKey, sidStar)); diff --git a/src/Compiler/Validate/OutputValidator.cs b/src/Compiler/Validate/OutputValidator.cs index 48398d30..da98a051 100644 --- a/src/Compiler/Validate/OutputValidator.cs +++ b/src/Compiler/Validate/OutputValidator.cs @@ -53,11 +53,12 @@ public class OutputValidator new AllActiveRunwaysMustReferenceAnAirport(), new AllActiveRunwaysMustReferenceARunway(), new AllActiveRunwaysMustBeUnique(), + new AllRunwayExitsMustHaveAValidRunway() }; public static void Validate(SectorElementCollection sectorElements, CompilerArguments args, IEventLogger events) { - foreach (IValidationRule rule in OutputValidator.ValidationRules) + foreach (IValidationRule rule in ValidationRules) { rule.Validate(sectorElements, args, events); } diff --git a/src/Compiler/Validate/RunwayValidator.cs b/src/Compiler/Validate/RunwayValidator.cs index 2ace254c..9343dfc2 100644 --- a/src/Compiler/Validate/RunwayValidator.cs +++ b/src/Compiler/Validate/RunwayValidator.cs @@ -8,12 +8,12 @@ public class RunwayValidator public static bool RunwayValid(string runway) { - return Regex.IsMatch(runway, RunwayValidator.RunwayRegex); + return Regex.IsMatch(runway, RunwayRegex); } public static bool RunwayValidIncludingAdjacent(string runway) { - return runway == "00" || Regex.IsMatch(runway, RunwayValidator.RunwayRegex); + return runway == "00" || Regex.IsMatch(runway, RunwayRegex); } } } diff --git a/tests/CompilerTest/Bogus/Factory/GroundNetworkCoordinateFactory.cs b/tests/CompilerTest/Bogus/Factory/GroundNetworkCoordinateFactory.cs new file mode 100644 index 00000000..569723cf --- /dev/null +++ b/tests/CompilerTest/Bogus/Factory/GroundNetworkCoordinateFactory.cs @@ -0,0 +1,21 @@ +using Bogus; +using Compiler.Model; + +namespace CompilerTest.Bogus.Factory +{ + static class GroundNetworkCoordinateFactory + { + public static GroundNetworkCoordinate Make(Coordinate? coordinate = null) + { + return new Faker() + .CustomInstantiator( + _ => new GroundNetworkCoordinate( + coordinate ?? CoordinateFactory.Make(), + DefinitionFactory.Make(), + DocblockFactory.Make(), + CommentFactory.Make() + ) + ); + } + } +} diff --git a/tests/CompilerTest/Bogus/Factory/GroundNetworkFactory.cs b/tests/CompilerTest/Bogus/Factory/GroundNetworkFactory.cs new file mode 100644 index 00000000..e4febbcd --- /dev/null +++ b/tests/CompilerTest/Bogus/Factory/GroundNetworkFactory.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using Bogus; +using Compiler.Model; + +namespace CompilerTest.Bogus.Factory +{ + static class GroundNetworkFactory + { + public static GroundNetwork Make(string airfield = "EGLL", List exits = null) + { + return new Faker() + .CustomInstantiator( + _ => new GroundNetwork( + airfield, + new List + { + GroundNetworkTaxiwayFactory.Make(), + GroundNetworkTaxiwayFactory.Make(), + GroundNetworkTaxiwayFactory.Make() + }, + exits ?? new List + { + GroundNetworkRunwayExitFactory.Make(), + GroundNetworkRunwayExitFactory.Make(), + GroundNetworkRunwayExitFactory.Make() + } + ) + ); + } + } +} diff --git a/tests/CompilerTest/Bogus/Factory/GroundNetworkRunwayExitFactory.cs b/tests/CompilerTest/Bogus/Factory/GroundNetworkRunwayExitFactory.cs new file mode 100644 index 00000000..d2a6f093 --- /dev/null +++ b/tests/CompilerTest/Bogus/Factory/GroundNetworkRunwayExitFactory.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using Bogus; +using Compiler.Model; + +namespace CompilerTest.Bogus.Factory +{ + static class GroundNetworkRunwayExitFactory + { + public static GroundNetworkRunwayExit Make(string runway = null) + { + return new Faker() + .CustomInstantiator( + faker => new GroundNetworkRunwayExit( + runway ?? "27L", + "N3W", + faker.Random.ArrayElement(new []{"LEFT", "RIGHT"}), + 15, + new List + { + GroundNetworkCoordinateFactory.Make(), + GroundNetworkCoordinateFactory.Make(), + GroundNetworkCoordinateFactory.Make() + }, + DefinitionFactory.Make(), + DocblockFactory.Make(), + CommentFactory.Make() + ) + ); + } + } +} diff --git a/tests/CompilerTest/Bogus/Factory/GroundNetworkTaxiwayFactory.cs b/tests/CompilerTest/Bogus/Factory/GroundNetworkTaxiwayFactory.cs new file mode 100644 index 00000000..9f3f3164 --- /dev/null +++ b/tests/CompilerTest/Bogus/Factory/GroundNetworkTaxiwayFactory.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using Bogus; +using Compiler.Model; + +namespace CompilerTest.Bogus.Factory +{ + static class GroundNetworkTaxiwayFactory + { + public static GroundNetworkTaxiway Make() + { + return new Faker() + .CustomInstantiator( + _ => new GroundNetworkTaxiway( + "A", + 15, + 1, + "15", + new List + { + GroundNetworkCoordinateFactory.Make(), + GroundNetworkCoordinateFactory.Make(), + GroundNetworkCoordinateFactory.Make() + }, + DefinitionFactory.Make(), + DocblockFactory.Make(), + CommentFactory.Make() + ) + ); + } + } +} diff --git a/tests/CompilerTest/Collector/AbstractCollectorTestCase.cs b/tests/CompilerTest/Collector/AbstractCollectorTestCase.cs index fa6b7281..d8c48cbe 100644 --- a/tests/CompilerTest/Collector/AbstractCollectorTestCase.cs +++ b/tests/CompilerTest/Collector/AbstractCollectorTestCase.cs @@ -15,7 +15,7 @@ public abstract class AbstractCollectorTestCase protected void AssertCollectedItems(IEnumerable expected) { - List actual = this.GetCollector().GetCompilableElements().ToList(); + List actual = GetCollector().GetCompilableElements().ToList(); List expectedList = expected.ToList(); Assert.Equal(expectedList.Count, actual.Count); @@ -27,8 +27,8 @@ protected void AssertCollectedItems(IEnumerable expe protected ICompilableElementCollector GetCollector() { - return new CompilableElementCollectorFactory(this.sectorElements, this.outputGroups) - .GetCollectorForOutputSection(this.GetOutputSection()); + return new CompilableElementCollectorFactory(sectorElements, outputGroups) + .GetCollectorForOutputSection(GetOutputSection()); } abstract protected OutputSectionKeys GetOutputSection(); diff --git a/tests/CompilerTest/Collector/ActiveRunwayCollectorTest.cs b/tests/CompilerTest/Collector/ActiveRunwayCollectorTest.cs index 763eaa0b..a19a6c1c 100644 --- a/tests/CompilerTest/Collector/ActiveRunwayCollectorTest.cs +++ b/tests/CompilerTest/Collector/ActiveRunwayCollectorTest.cs @@ -17,11 +17,11 @@ public void TestItReturnsElementsInOrder() ActiveRunway fourth = ActiveRunwayFactory.Make("EGLL", "09R", 0); ActiveRunway fifth = ActiveRunwayFactory.Make("EGKK", "26L", 0); - this.sectorElements.Add(first); - this.sectorElements.Add(second); - this.sectorElements.Add(third); - this.sectorElements.Add(fourth); - this.sectorElements.Add(fifth); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); + sectorElements.Add(fourth); + sectorElements.Add(fifth); IEnumerable expected = new List() { @@ -31,7 +31,7 @@ public void TestItReturnsElementsInOrder() fourth, second }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/AirportsCollectorTest.cs b/tests/CompilerTest/Collector/AirportsCollectorTest.cs index e21908cb..20bf5205 100644 --- a/tests/CompilerTest/Collector/AirportsCollectorTest.cs +++ b/tests/CompilerTest/Collector/AirportsCollectorTest.cs @@ -15,9 +15,9 @@ public void TestItReturnsElementsInOrder() Airport second = AirportFactory.Make("EGCC"); Airport third = AirportFactory.Make("EGLL"); - this.sectorElements.Add(first); - this.sectorElements.Add(second); - this.sectorElements.Add(third); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); IEnumerable expected = new List() { @@ -25,7 +25,7 @@ public void TestItReturnsElementsInOrder() first, third }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/AirspaceCollectorTest.cs b/tests/CompilerTest/Collector/AirspaceCollectorTest.cs index e2c9b7ce..1ecb80cf 100644 --- a/tests/CompilerTest/Collector/AirspaceCollectorTest.cs +++ b/tests/CompilerTest/Collector/AirspaceCollectorTest.cs @@ -13,8 +13,8 @@ public void TestItReturnsElementsInOrder() { OutputGroup group1 = new("1"); OutputGroup group2 = new("2"); - this.outputGroups.AddGroupWithFiles(group1, new List{"foo.txt"}); - this.outputGroups.AddGroupWithFiles(group2, new List{"goo.txt"}); + outputGroups.AddGroupWithFiles(group1, new List{"foo.txt"}); + outputGroups.AddGroupWithFiles(group2, new List{"goo.txt"}); Sectorline line1 = SectorlineFactory.Make(definition: DefinitionFactory.Make("foo.txt")); Sectorline line2 = SectorlineFactory.Make(definition: DefinitionFactory.Make("goo.txt")); @@ -27,14 +27,14 @@ public void TestItReturnsElementsInOrder() CoordinationPoint point2 = CoordinationPointFactory.Make(true, definition: DefinitionFactory.Make("foo.txt")); CoordinationPoint point3 = CoordinationPointFactory.Make(false, definition: DefinitionFactory.Make("goo.txt")); - this.sectorElements.Add(line1); - this.sectorElements.Add(line2); - this.sectorElements.Add(line3); - this.sectorElements.Add(sector1); - this.sectorElements.Add(sector2); - this.sectorElements.Add(point1); - this.sectorElements.Add(point2); - this.sectorElements.Add(point3); + sectorElements.Add(line1); + sectorElements.Add(line2); + sectorElements.Add(line3); + sectorElements.Add(sector1); + sectorElements.Add(sector2); + sectorElements.Add(point1); + sectorElements.Add(point2); + sectorElements.Add(point3); IEnumerable expected = new List() { @@ -47,7 +47,7 @@ public void TestItReturnsElementsInOrder() point3, point2 }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/ArtccCollectorTest.cs b/tests/CompilerTest/Collector/ArtccCollectorTest.cs index a14c5dc8..cddef7b7 100644 --- a/tests/CompilerTest/Collector/ArtccCollectorTest.cs +++ b/tests/CompilerTest/Collector/ArtccCollectorTest.cs @@ -15,9 +15,9 @@ public void TestItReturnsElementsInOrder() ArtccSegment second = ArtccSegmentFactory.Make(identifier: "EGPX"); ArtccSegment third = ArtccSegmentFactory.Make(identifier: "EISN"); - this.sectorElements.Add(first); - this.sectorElements.Add(second); - this.sectorElements.Add(third); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); IEnumerable expected = new List() { @@ -25,7 +25,7 @@ public void TestItReturnsElementsInOrder() first, third }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/ColoursCollectorTest.cs b/tests/CompilerTest/Collector/ColoursCollectorTest.cs index 940fa997..969ef5ae 100644 --- a/tests/CompilerTest/Collector/ColoursCollectorTest.cs +++ b/tests/CompilerTest/Collector/ColoursCollectorTest.cs @@ -15,9 +15,9 @@ public void TestItReturnsElementsInOrder() Colour second = ColourFactory.Make("green"); Colour third = ColourFactory.Make("blue"); - this.sectorElements.Add(first); - this.sectorElements.Add(second); - this.sectorElements.Add(third); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); IEnumerable expected = new List() { @@ -25,7 +25,7 @@ public void TestItReturnsElementsInOrder() second, first }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/CompilableElementCollectorFactoryTest.cs b/tests/CompilerTest/Collector/CompilableElementCollectorFactoryTest.cs index 06c526bd..4124c2cd 100644 --- a/tests/CompilerTest/Collector/CompilableElementCollectorFactoryTest.cs +++ b/tests/CompilerTest/Collector/CompilableElementCollectorFactoryTest.cs @@ -41,12 +41,13 @@ public CompilableElementCollectorFactoryTest() [InlineData(OutputSectionKeys.ESE_FREETEXT, typeof(FreetextCollector))] [InlineData(OutputSectionKeys.ESE_SIDSSTARS, typeof(SidStarsCollector))] [InlineData(OutputSectionKeys.ESE_AIRSPACE, typeof(AirspaceCollector))] + [InlineData(OutputSectionKeys.ESE_GROUND_NETWORK, typeof(GroundNetworkCollector))] [InlineData(OutputSectionKeys.RWY_ACTIVE_RUNWAYS, typeof(ActiveRunwaysCollector))] public void TestItReturnsCorrectCollector(OutputSectionKeys outputType, Type expectedType) { Assert.Equal( expectedType, - this.factory.GetCollectorForOutputSection(outputType).GetType() + factory.GetCollectorForOutputSection(outputType).GetType() ); } } diff --git a/tests/CompilerTest/Collector/FixesCollectorTest.cs b/tests/CompilerTest/Collector/FixesCollectorTest.cs index 3c373e4f..cf2a94f0 100644 --- a/tests/CompilerTest/Collector/FixesCollectorTest.cs +++ b/tests/CompilerTest/Collector/FixesCollectorTest.cs @@ -15,9 +15,9 @@ public void TestItReturnsElementsInOrder() Fix second = FixFactory.Make("BOMBO"); Fix third = FixFactory.Make("MONTY"); - this.sectorElements.Add(first); - this.sectorElements.Add(second); - this.sectorElements.Add(third); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); IEnumerable expected = new List() { @@ -25,7 +25,7 @@ public void TestItReturnsElementsInOrder() first, third }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/FreetextCollectorTest.cs b/tests/CompilerTest/Collector/FreetextCollectorTest.cs index 8085afa0..d760b5a2 100644 --- a/tests/CompilerTest/Collector/FreetextCollectorTest.cs +++ b/tests/CompilerTest/Collector/FreetextCollectorTest.cs @@ -13,16 +13,16 @@ public void TestItReturnsElementsInOrder() { OutputGroup group1 = new("1"); OutputGroup group2 = new("2"); - this.outputGroups.AddGroupWithFiles(group1, new List{"foo.txt"}); - this.outputGroups.AddGroupWithFiles(group2, new List{"goo.txt"}); + outputGroups.AddGroupWithFiles(group1, new List{"foo.txt"}); + outputGroups.AddGroupWithFiles(group2, new List{"goo.txt"}); Freetext first = FreetextFactory.Make(DefinitionFactory.Make("foo.txt")); Freetext second = FreetextFactory.Make(DefinitionFactory.Make("goo.txt")); Freetext third = FreetextFactory.Make(DefinitionFactory.Make("foo.txt")); - this.sectorElements.Add(first); - this.sectorElements.Add(second); - this.sectorElements.Add(third); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); IEnumerable expected = new List() { @@ -30,7 +30,7 @@ public void TestItReturnsElementsInOrder() third, second }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/GroundNetworkCollectorTest.cs b/tests/CompilerTest/Collector/GroundNetworkCollectorTest.cs new file mode 100644 index 00000000..602e22be --- /dev/null +++ b/tests/CompilerTest/Collector/GroundNetworkCollectorTest.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using Compiler.Model; +using Compiler.Output; +using CompilerTest.Bogus.Factory; +using Xunit; + +namespace CompilerTest.Collector +{ + public class GroundNetworkCollectorTest: AbstractCollectorTestCase + { + [Fact] + public void TestItReturnsElementsInOrder() + { + GroundNetwork first = GroundNetworkFactory.Make("EGKK"); + GroundNetwork second = GroundNetworkFactory.Make("EGGD"); + GroundNetwork third = GroundNetworkFactory.Make("EGAC"); + + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); + + IEnumerable expected = new List() + { + third, + second, + first + }; + AssertCollectedItems(expected); + } + + protected override OutputSectionKeys GetOutputSection() + { + return OutputSectionKeys.ESE_GROUND_NETWORK; + } + } +} diff --git a/tests/CompilerTest/Collector/HeaderCollectorTest.cs b/tests/CompilerTest/Collector/HeaderCollectorTest.cs index 052c0848..eb8c8cb2 100644 --- a/tests/CompilerTest/Collector/HeaderCollectorTest.cs +++ b/tests/CompilerTest/Collector/HeaderCollectorTest.cs @@ -13,13 +13,13 @@ public void TestItReturnsElementsInOrder() { Header header = new(DefinitionFactory.Make(), new List()); - this.sectorElements.Add(header); + sectorElements.Add(header); IEnumerable expected = new List() { header }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/HighAirwaysCollectorTest.cs b/tests/CompilerTest/Collector/HighAirwaysCollectorTest.cs index ec83a9f1..1f8ec2a1 100644 --- a/tests/CompilerTest/Collector/HighAirwaysCollectorTest.cs +++ b/tests/CompilerTest/Collector/HighAirwaysCollectorTest.cs @@ -15,9 +15,9 @@ public void TestItReturnsElementsInOrder() AirwaySegment second = AirwaySegmentFactory.Make(AirwayType.HIGH, "N862"); AirwaySegment third = AirwaySegmentFactory.Make(AirwayType.HIGH, "L9"); - this.sectorElements.Add(first); - this.sectorElements.Add(second); - this.sectorElements.Add(third); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); IEnumerable expected = new List() { @@ -25,7 +25,7 @@ public void TestItReturnsElementsInOrder() second, first }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/HighArtccCollectorTest.cs b/tests/CompilerTest/Collector/HighArtccCollectorTest.cs index 551dfdf2..25af5749 100644 --- a/tests/CompilerTest/Collector/HighArtccCollectorTest.cs +++ b/tests/CompilerTest/Collector/HighArtccCollectorTest.cs @@ -15,9 +15,9 @@ public void TestItReturnsElementsInOrder() ArtccSegment second = ArtccSegmentFactory.Make(ArtccType.HIGH, "EGPX"); ArtccSegment third = ArtccSegmentFactory.Make(ArtccType.HIGH, "EISN"); - this.sectorElements.Add(first); - this.sectorElements.Add(second); - this.sectorElements.Add(third); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); IEnumerable expected = new List() { @@ -25,7 +25,7 @@ public void TestItReturnsElementsInOrder() first, third }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/InfoCollectorTest.cs b/tests/CompilerTest/Collector/InfoCollectorTest.cs index 89edc547..fe82d4f1 100644 --- a/tests/CompilerTest/Collector/InfoCollectorTest.cs +++ b/tests/CompilerTest/Collector/InfoCollectorTest.cs @@ -13,13 +13,13 @@ public void TestItReturnsElementsInOrder() { Info info = InfoFactory.Make(); - this.sectorElements.Add(info); + sectorElements.Add(info); IEnumerable expected = new List() { info }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/LabelsCollectorTest.cs b/tests/CompilerTest/Collector/LabelsCollectorTest.cs index 531841d7..e4350894 100644 --- a/tests/CompilerTest/Collector/LabelsCollectorTest.cs +++ b/tests/CompilerTest/Collector/LabelsCollectorTest.cs @@ -13,16 +13,16 @@ public void TestItReturnsElementsInOrder() { OutputGroup group1 = new("1"); OutputGroup group2 = new("2"); - this.outputGroups.AddGroupWithFiles(group1, new List{"foo.txt"}); - this.outputGroups.AddGroupWithFiles(group2, new List{"goo.txt"}); + outputGroups.AddGroupWithFiles(group1, new List{"foo.txt"}); + outputGroups.AddGroupWithFiles(group2, new List{"goo.txt"}); Label first = LabelFactory.Make(definition: DefinitionFactory.Make("foo.txt")); Label second = LabelFactory.Make(definition: DefinitionFactory.Make("goo.txt")); Label third = LabelFactory.Make(definition: DefinitionFactory.Make("foo.txt")); - this.sectorElements.Add(first); - this.sectorElements.Add(second); - this.sectorElements.Add(third); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); IEnumerable expected = new List() { @@ -30,7 +30,7 @@ public void TestItReturnsElementsInOrder() third, second }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/LowAirwaysCollectorTest.cs b/tests/CompilerTest/Collector/LowAirwaysCollectorTest.cs index 5fc12c51..18839058 100644 --- a/tests/CompilerTest/Collector/LowAirwaysCollectorTest.cs +++ b/tests/CompilerTest/Collector/LowAirwaysCollectorTest.cs @@ -15,9 +15,9 @@ public void TestItReturnsElementsInOrder() AirwaySegment second = AirwaySegmentFactory.Make(identifier: "N862"); AirwaySegment third = AirwaySegmentFactory.Make(identifier: "L9"); - this.sectorElements.Add(first); - this.sectorElements.Add(second); - this.sectorElements.Add(third); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); IEnumerable expected = new List() { @@ -25,7 +25,7 @@ public void TestItReturnsElementsInOrder() second, first }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/LowArtccCollectorTest.cs b/tests/CompilerTest/Collector/LowArtccCollectorTest.cs index e9e483af..9c9850b1 100644 --- a/tests/CompilerTest/Collector/LowArtccCollectorTest.cs +++ b/tests/CompilerTest/Collector/LowArtccCollectorTest.cs @@ -15,9 +15,9 @@ public void TestItReturnsElementsInOrder() ArtccSegment second = ArtccSegmentFactory.Make(ArtccType.LOW, "EGPX"); ArtccSegment third = ArtccSegmentFactory.Make(ArtccType.LOW, "EISN"); - this.sectorElements.Add(first); - this.sectorElements.Add(second); - this.sectorElements.Add(third); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); IEnumerable expected = new List() { @@ -25,7 +25,7 @@ public void TestItReturnsElementsInOrder() first, third }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/NdbsCollectorTest.cs b/tests/CompilerTest/Collector/NdbsCollectorTest.cs index 4e0ae5fb..343790e3 100644 --- a/tests/CompilerTest/Collector/NdbsCollectorTest.cs +++ b/tests/CompilerTest/Collector/NdbsCollectorTest.cs @@ -15,9 +15,9 @@ public void TestItReturnsElementsInOrder() Ndb second = NdbFactory.Make("BRI"); Ndb third = NdbFactory.Make("OF"); - this.sectorElements.Add(first); - this.sectorElements.Add(second); - this.sectorElements.Add(third); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); IEnumerable expected = new List() { @@ -25,7 +25,7 @@ public void TestItReturnsElementsInOrder() first, third }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/PositionsCollectorTest.cs b/tests/CompilerTest/Collector/PositionsCollectorTest.cs index a4998586..2f1a40b0 100644 --- a/tests/CompilerTest/Collector/PositionsCollectorTest.cs +++ b/tests/CompilerTest/Collector/PositionsCollectorTest.cs @@ -13,8 +13,8 @@ public void TestItReturnsElementsInOrder() { OutputGroup group1 = new("1"); OutputGroup group2 = new("2"); - this.outputGroups.AddGroupWithFiles(group1, new List{"foo.txt"}); - this.outputGroups.AddGroupWithFiles(group2, new List{"goo.txt"}); + outputGroups.AddGroupWithFiles(group1, new List{"foo.txt"}); + outputGroups.AddGroupWithFiles(group2, new List{"goo.txt"}); ControllerPosition first = ControllerPositionFactory.Make( order: PositionOrder.MENTOR_POSITION, @@ -41,12 +41,12 @@ public void TestItReturnsElementsInOrder() definition: DefinitionFactory.Make("foo.txt") ); - this.sectorElements.Add(first); - this.sectorElements.Add(second); - this.sectorElements.Add(third); - this.sectorElements.Add(fourth); - this.sectorElements.Add(fifth); - this.sectorElements.Add(sixth); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); + sectorElements.Add(fourth); + sectorElements.Add(fifth); + sectorElements.Add(sixth); IEnumerable expected = new List() { @@ -57,7 +57,7 @@ public void TestItReturnsElementsInOrder() second, first }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/RegionsCollectorTest.cs b/tests/CompilerTest/Collector/RegionsCollectorTest.cs index 5636aba3..5c19e18f 100644 --- a/tests/CompilerTest/Collector/RegionsCollectorTest.cs +++ b/tests/CompilerTest/Collector/RegionsCollectorTest.cs @@ -13,16 +13,16 @@ public void TestItReturnsElementsInOrder() { OutputGroup group1 = new("1"); OutputGroup group2 = new("2"); - this.outputGroups.AddGroupWithFiles(group1, new List{"foo.txt"}); - this.outputGroups.AddGroupWithFiles(group2, new List{"goo.txt"}); + outputGroups.AddGroupWithFiles(group1, new List{"foo.txt"}); + outputGroups.AddGroupWithFiles(group2, new List{"goo.txt"}); Region first = RegionFactory.Make(definition: DefinitionFactory.Make("foo.txt")); Region second = RegionFactory.Make(definition: DefinitionFactory.Make("goo.txt")); Region third = RegionFactory.Make(definition: DefinitionFactory.Make("foo.txt")); - this.sectorElements.Add(first); - this.sectorElements.Add(second); - this.sectorElements.Add(third); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); IEnumerable expected = new List() { @@ -30,7 +30,7 @@ public void TestItReturnsElementsInOrder() third, second }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/RunwaysCollectorTest.cs b/tests/CompilerTest/Collector/RunwaysCollectorTest.cs index e15e84bf..2040da67 100644 --- a/tests/CompilerTest/Collector/RunwaysCollectorTest.cs +++ b/tests/CompilerTest/Collector/RunwaysCollectorTest.cs @@ -17,11 +17,11 @@ public void TestItReturnsElementsInOrder() Runway fourth = RunwayFactory.Make("EGCC", "23R"); Runway fifth = RunwayFactory.Make("EGGD", "09"); - this.sectorElements.Add(first); - this.sectorElements.Add(second); - this.sectorElements.Add(third); - this.sectorElements.Add(fourth); - this.sectorElements.Add(fifth); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); + sectorElements.Add(fourth); + sectorElements.Add(fifth); IEnumerable expected = new List() { @@ -31,7 +31,7 @@ public void TestItReturnsElementsInOrder() first, third }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/SidStarsCollectorTest.cs b/tests/CompilerTest/Collector/SidStarsCollectorTest.cs index f25159df..458dbb07 100644 --- a/tests/CompilerTest/Collector/SidStarsCollectorTest.cs +++ b/tests/CompilerTest/Collector/SidStarsCollectorTest.cs @@ -18,12 +18,12 @@ public void TestItReturnsElementsInOrder() SidStar fifth = SidStarFactory.Make(false, "EGCC", identifier: "SANBA1R"); SidStar sixth = SidStarFactory.Make(false, "EGCC", identifier: "LISTO1S"); - this.sectorElements.Add(first); - this.sectorElements.Add(second); - this.sectorElements.Add(third); - this.sectorElements.Add(fourth); - this.sectorElements.Add(fifth); - this.sectorElements.Add(sixth); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); + sectorElements.Add(fourth); + sectorElements.Add(fifth); + sectorElements.Add(sixth); IEnumerable expected = new List() { @@ -34,7 +34,7 @@ public void TestItReturnsElementsInOrder() sixth, fifth }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/SidsCollectorTest.cs b/tests/CompilerTest/Collector/SidsCollectorTest.cs index 3af67cff..99e6130a 100644 --- a/tests/CompilerTest/Collector/SidsCollectorTest.cs +++ b/tests/CompilerTest/Collector/SidsCollectorTest.cs @@ -13,16 +13,16 @@ public void TestItReturnsElementsInOrder() { OutputGroup group1 = new("1"); OutputGroup group2 = new("2"); - this.outputGroups.AddGroupWithFiles(group1, new List{"foo.txt"}); - this.outputGroups.AddGroupWithFiles(group2, new List{"goo.txt"}); + outputGroups.AddGroupWithFiles(group1, new List{"foo.txt"}); + outputGroups.AddGroupWithFiles(group2, new List{"goo.txt"}); SidStarRoute first = SidStarRouteFactory.Make(definition: DefinitionFactory.Make("foo.txt")); SidStarRoute second = SidStarRouteFactory.Make(definition: DefinitionFactory.Make("goo.txt")); SidStarRoute third = SidStarRouteFactory.Make(definition: DefinitionFactory.Make("foo.txt")); - this.sectorElements.Add(first); - this.sectorElements.Add(second); - this.sectorElements.Add(third); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); IEnumerable expected = new List() { @@ -30,7 +30,7 @@ public void TestItReturnsElementsInOrder() third, second }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/StarsCollectorTest.cs b/tests/CompilerTest/Collector/StarsCollectorTest.cs index c7c40bc7..059b6b6f 100644 --- a/tests/CompilerTest/Collector/StarsCollectorTest.cs +++ b/tests/CompilerTest/Collector/StarsCollectorTest.cs @@ -13,16 +13,16 @@ public void TestItReturnsElementsInOrder() { OutputGroup group1 = new("1"); OutputGroup group2 = new("2"); - this.outputGroups.AddGroupWithFiles(group1, new List{"foo.txt"}); - this.outputGroups.AddGroupWithFiles(group2, new List{"goo.txt"}); + outputGroups.AddGroupWithFiles(group1, new List{"foo.txt"}); + outputGroups.AddGroupWithFiles(group2, new List{"goo.txt"}); SidStarRoute first = SidStarRouteFactory.Make(SidStarType.STAR, definition: DefinitionFactory.Make("foo.txt")); SidStarRoute second = SidStarRouteFactory.Make(SidStarType.STAR, definition: DefinitionFactory.Make("goo.txt")); SidStarRoute third = SidStarRouteFactory.Make(SidStarType.STAR, definition: DefinitionFactory.Make("foo.txt")); - this.sectorElements.Add(first); - this.sectorElements.Add(second); - this.sectorElements.Add(third); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); IEnumerable expected = new List() { @@ -30,7 +30,7 @@ public void TestItReturnsElementsInOrder() third, second }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Collector/VorsCollectorTest.cs b/tests/CompilerTest/Collector/VorsCollectorTest.cs index 063f0739..3f9f3ec0 100644 --- a/tests/CompilerTest/Collector/VorsCollectorTest.cs +++ b/tests/CompilerTest/Collector/VorsCollectorTest.cs @@ -15,9 +15,9 @@ public void TestItReturnsElementsInOrder() Vor second = VorFactory.Make("BIG"); Vor third = VorFactory.Make("KOK"); - this.sectorElements.Add(first); - this.sectorElements.Add(second); - this.sectorElements.Add(third); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); IEnumerable expected = new List() { @@ -25,7 +25,7 @@ public void TestItReturnsElementsInOrder() first, third }; - this.AssertCollectedItems(expected); + AssertCollectedItems(expected); } protected override OutputSectionKeys GetOutputSection() diff --git a/tests/CompilerTest/Input/SectorDataReaderFactoryTest.cs b/tests/CompilerTest/Input/SectorDataReaderFactoryTest.cs index fed36b32..61eb2208 100644 --- a/tests/CompilerTest/Input/SectorDataReaderFactoryTest.cs +++ b/tests/CompilerTest/Input/SectorDataReaderFactoryTest.cs @@ -9,6 +9,7 @@ public class SectorDataReaderFactoryTest [Theory] [InlineData(InputDataType.ESE_AGREEMENTS, typeof(EseSectorDataReader))] [InlineData(InputDataType.ESE_FREETEXT, typeof(EseSectorDataReader))] + [InlineData(InputDataType.ESE_GROUND_NETWORK, typeof(EseSectorDataReader))] [InlineData(InputDataType.ESE_POSITIONS_MENTOR, typeof(EseSectorDataReader))] [InlineData(InputDataType.ESE_OWNERSHIP, typeof(EseSectorDataReader))] [InlineData(InputDataType.ESE_POSITIONS, typeof(EseSectorDataReader))] diff --git a/tests/CompilerTest/Model/GroundNetworkCoordinateTest.cs b/tests/CompilerTest/Model/GroundNetworkCoordinateTest.cs new file mode 100644 index 00000000..4615984f --- /dev/null +++ b/tests/CompilerTest/Model/GroundNetworkCoordinateTest.cs @@ -0,0 +1,33 @@ +using Xunit; +using Compiler.Model; +using CompilerTest.Bogus.Factory; + +namespace CompilerTest.Model +{ + public class GroundNetworkCoordinateTest + { + private readonly GroundNetworkCoordinate coordinate; + + public GroundNetworkCoordinateTest() + { + coordinate = new GroundNetworkCoordinate( + new Coordinate("abc", "def"), + DefinitionFactory.Make(), + DocblockFactory.Make(), + CommentFactory.Make() + ); + } + + [Fact] + public void TestItSetsCoordinate() + { + Assert.Equal(new Coordinate("abc", "def"), coordinate.Coordinate); + } + + [Fact] + public void TestItCompiles() + { + Assert.Equal("COORD:abc:def", coordinate.GetCompileData(new SectorElementCollection())); + } + } +} diff --git a/tests/CompilerTest/Model/GroundNetworkRunwayExitTest.cs b/tests/CompilerTest/Model/GroundNetworkRunwayExitTest.cs new file mode 100644 index 00000000..5b1d294e --- /dev/null +++ b/tests/CompilerTest/Model/GroundNetworkRunwayExitTest.cs @@ -0,0 +1,84 @@ +using System.Collections.Generic; +using Xunit; +using Compiler.Model; +using CompilerTest.Bogus.Factory; + +namespace CompilerTest.Model +{ + public class GroundNetworkRunwayExitTest + { + private readonly GroundNetworkRunwayExit exit; + private List coordinates; + private GroundNetworkCoordinate coordinate1; + private GroundNetworkCoordinate coordinate2; + + public GroundNetworkRunwayExitTest() + { + coordinate1 = GroundNetworkCoordinateFactory.Make(new Coordinate("abc", "def")); + coordinate2 = GroundNetworkCoordinateFactory.Make(new Coordinate("abc", "ghi")); + coordinates = new List + { + coordinate1, + coordinate2 + }; + exit = new GroundNetworkRunwayExit( + "27L", + "N3W", + "LEFT", + 15, + coordinates, + DefinitionFactory.Make(), + DocblockFactory.Make(), + CommentFactory.Make() + ); + } + + [Fact] + public void TestItSetsRunway() + { + Assert.Equal("27L", exit.Runway); + } + + [Fact] + public void TestItSetsExitName() + { + Assert.Equal("N3W", exit.ExitName); + } + + [Fact] + public void TestItSetsDirection() + { + Assert.Equal("LEFT", exit.Direction); + } + + [Fact] + public void TestItSetsMaximumSpeed() + { + Assert.Equal(15, exit.MaximumSpeed); + } + + [Fact] + public void TestItSetsCoordinates() + { + Assert.Equal(coordinates, exit.Coordinates); + } + + [Fact] + public void TestItCompiles() + { + Assert.Equal("EXIT:27L:N3W:LEFT:15", exit.GetCompileData(new SectorElementCollection())); + } + + [Fact] + public void TestItReturnsCompilableElements() + { + var expected = new List + { + exit, + coordinate1, + coordinate2 + }; + Assert.Equal(expected, exit.GetCompilableElements()); + } + } +} diff --git a/tests/CompilerTest/Model/GroundNetworkTaxiwayTest.cs b/tests/CompilerTest/Model/GroundNetworkTaxiwayTest.cs new file mode 100644 index 00000000..3c7ce43b --- /dev/null +++ b/tests/CompilerTest/Model/GroundNetworkTaxiwayTest.cs @@ -0,0 +1,100 @@ +using System.Collections.Generic; +using Xunit; +using Compiler.Model; +using CompilerTest.Bogus.Factory; + +namespace CompilerTest.Model +{ + public class GroundNetworkTaxiwayTest + { + private readonly GroundNetworkTaxiway taxiway; + private List coordinates; + private GroundNetworkCoordinate coordinate1; + private GroundNetworkCoordinate coordinate2; + + public GroundNetworkTaxiwayTest() + { + coordinate1 = GroundNetworkCoordinateFactory.Make(new Coordinate("abc", "def")); + coordinate2 = GroundNetworkCoordinateFactory.Make(new Coordinate("abc", "ghi")); + coordinates = new List + { + coordinate1, + coordinate2 + }; + taxiway = new GroundNetworkTaxiway( + "A", + 15, + 1, + "55L", + coordinates, + DefinitionFactory.Make(), + DocblockFactory.Make(), + CommentFactory.Make() + ); + } + + [Fact] + public void TestItSetsName() + { + Assert.Equal("A", taxiway.Name); + } + + [Fact] + public void TestItSetsMaximumSpeed() + { + Assert.Equal(15, taxiway.MaximumSpeed); + } + + [Fact] + public void TestItSetsUsageFlag() + { + Assert.Equal(1, taxiway.UsageFlag); + } + + [Fact] + public void TestItSetsGateName() + { + Assert.Equal("55L", taxiway.GateName); + } + + [Fact] + public void TestItSetsCoordinates() + { + Assert.Equal(coordinates, taxiway.Coordinates); + } + + [Fact] + public void TestItCompiles() + { + Assert.Equal("TAXI:A:15:1:55L", taxiway.GetCompileData(new SectorElementCollection())); + } + + [Fact] + public void TestItReturnsCompilableElements() + { + var expected = new List + { + taxiway, + coordinate1, + coordinate2 + }; + Assert.Equal(expected, taxiway.GetCompilableElements()); + } + + [Fact] + public void TestItCompilesWithNulls() + { + var taxiway2 = new GroundNetworkTaxiway( + "A", + 15, + null, + null, + coordinates, + DefinitionFactory.Make(), + DocblockFactory.Make(), + CommentFactory.Make() + ); + Assert.Equal("TAXI:A:15::", taxiway2.GetCompileData(new SectorElementCollection())); + } + } +} diff --git a/tests/CompilerTest/Model/GroundNetworkTest.cs b/tests/CompilerTest/Model/GroundNetworkTest.cs new file mode 100644 index 00000000..1c987393 --- /dev/null +++ b/tests/CompilerTest/Model/GroundNetworkTest.cs @@ -0,0 +1,73 @@ +using System.Collections.Generic; +using Xunit; +using Compiler.Model; +using CompilerTest.Bogus.Factory; + +namespace CompilerTest.Model +{ + public class GroundNetworkTest + { + private readonly GroundNetwork network; + private readonly GroundNetworkTaxiway taxiway1; + private readonly GroundNetworkTaxiway taxiway2; + private readonly GroundNetworkRunwayExit exit1; + private readonly GroundNetworkRunwayExit exit2; + private List exits; + private List taxiways; + + public GroundNetworkTest() + { + taxiway1 = GroundNetworkTaxiwayFactory.Make(); + taxiway2 = GroundNetworkTaxiwayFactory.Make(); + taxiways = new List + { + taxiway1, + taxiway2 + }; + exit1 = GroundNetworkRunwayExitFactory.Make(); + exit2 = GroundNetworkRunwayExitFactory.Make(); + exits = new List + { + exit1, + exit2 + }; + + network = new GroundNetwork( + "EGLL", + taxiways, + exits + ); + } + + [Fact] + public void TestItSetsAirport() + { + Assert.Equal("EGLL", network.Airport); + } + + [Fact] + public void TestItSetsTaxiways() + { + Assert.Equal(taxiways, network.Taxiways); + } + + [Fact] + public void TestItSetsRunwayExits() + { + Assert.Equal(exits, network.RunwayExits); + } + + [Fact] + public void TestItReturnsCompilableElements() + { + var expected = new List + { + taxiway1, + taxiway2, + exit1, + exit2 + }; + Assert.Equal(expected, network.GetCompilableElements()); + } + } +} diff --git a/tests/CompilerTest/Model/SectorElementCollectionTest.cs b/tests/CompilerTest/Model/SectorElementCollectionTest.cs index 5087fd3f..156fc956 100644 --- a/tests/CompilerTest/Model/SectorElementCollectionTest.cs +++ b/tests/CompilerTest/Model/SectorElementCollectionTest.cs @@ -10,194 +10,194 @@ public class SectorElementCollectionTest public SectorElementCollectionTest() { - this.collection = new SectorElementCollection(); + collection = new SectorElementCollection(); } [Fact] public void TestItAddsSidStars() { SidStar sidStar = SidStarFactory.Make(); - this.collection.Add(sidStar); + collection.Add(sidStar); - Assert.Equal(sidStar, this.collection.SidStars[0]); + Assert.Equal(sidStar, collection.SidStars[0]); } [Fact] public void TestItAddsColours() { Colour colour = ColourFactory.Make(); - this.collection.Add(colour); + collection.Add(colour); - Assert.Equal(colour, this.collection.Colours[0]); + Assert.Equal(colour, collection.Colours[0]); } [Fact] public void TestItAddsAirports() { Airport airport = AirportFactory.Make(); - this.collection.Add(airport); + collection.Add(airport); - Assert.Equal(airport, this.collection.Airports[0]); + Assert.Equal(airport, collection.Airports[0]); } [Fact] public void TestItAddsRunways() { Runway runway = RunwayFactory.Make(); - this.collection.Add(runway); + collection.Add(runway); - Assert.Equal(runway, this.collection.Runways[0]); + Assert.Equal(runway, collection.Runways[0]); } [Fact] public void TestItAddsActiveRunways() { ActiveRunway runway = ActiveRunwayFactory.Make(); - this.collection.Add(runway); + collection.Add(runway); - Assert.Equal(runway, this.collection.ActiveRunways[0]); + Assert.Equal(runway, collection.ActiveRunways[0]); } [Fact] public void TestItAddsArtccs() { ArtccSegment artcc = ArtccSegmentFactory.Make(); - this.collection.Add(artcc); + collection.Add(artcc); - Assert.Equal(artcc, this.collection.Artccs[0]); + Assert.Equal(artcc, collection.Artccs[0]); } [Fact] public void TestItAddsLowArtccs() { ArtccSegment artcc = ArtccSegmentFactory.Make(ArtccType.LOW); - this.collection.Add(artcc); + collection.Add(artcc); - Assert.Equal(artcc, this.collection.LowArtccs[0]); + Assert.Equal(artcc, collection.LowArtccs[0]); } [Fact] public void TestItAddsHighArtccs() { ArtccSegment artcc = ArtccSegmentFactory.Make(ArtccType.HIGH); - this.collection.Add(artcc); + collection.Add(artcc); - Assert.Equal(artcc, this.collection.HighArtccs[0]); + Assert.Equal(artcc, collection.HighArtccs[0]); } [Fact] public void TestItAddsLowAirways() { AirwaySegment airway = AirwaySegmentFactory.Make(); - this.collection.Add(airway); + collection.Add(airway); - Assert.Equal(airway, this.collection.LowAirways[0]); + Assert.Equal(airway, collection.LowAirways[0]); } [Fact] public void TestItAddsHighAirways() { AirwaySegment airway = AirwaySegmentFactory.Make(AirwayType.HIGH); - this.collection.Add(airway); + collection.Add(airway); - Assert.Equal(airway, this.collection.HighAirways[0]); + Assert.Equal(airway, collection.HighAirways[0]); } [Fact] public void TestItAddsFixes() { Fix fix = FixFactory.Make(); - this.collection.Add(fix); + collection.Add(fix); - Assert.Equal(fix, this.collection.Fixes[0]); + Assert.Equal(fix, collection.Fixes[0]); } [Fact] public void TestItAddsGeo() { Geo geo = GeoFactory.Make(); - this.collection.Add(geo); + collection.Add(geo); - Assert.Equal(geo, this.collection.GeoElements[0]); + Assert.Equal(geo, collection.GeoElements[0]); } [Fact] public void TestItAddsLabel() { Label label = LabelFactory.Make(); - this.collection.Add(label); + collection.Add(label); - Assert.Equal(label, this.collection.Labels[0]); + Assert.Equal(label, collection.Labels[0]); } [Fact] public void TestItAddsRegions() { Region region = RegionFactory.Make(); - this.collection.Add(region); + collection.Add(region); - Assert.Equal(region, this.collection.Regions[0]); + Assert.Equal(region, collection.Regions[0]); } [Fact] public void TestItAddsVors() { Vor vor = VorFactory.Make(); - this.collection.Add(vor); + collection.Add(vor); - Assert.Equal(vor, this.collection.Vors[0]); + Assert.Equal(vor, collection.Vors[0]); } [Fact] public void TestItAddsNdbs() { Ndb ndb = NdbFactory.Make(); - this.collection.Add(ndb); + collection.Add(ndb); - Assert.Equal(ndb, this.collection.Ndbs[0]); + Assert.Equal(ndb, collection.Ndbs[0]); } [Fact] public void TestItAddsInfo() { Info info = InfoFactory.Make(); - this.collection.Add(info); + collection.Add(info); - Assert.Equal(info, this.collection.Info); + Assert.Equal(info, collection.Info); } [Fact] public void TestItAddsFreetext() { Freetext freetext = FreetextFactory.Make(); - this.collection.Add(freetext); + collection.Add(freetext); - Assert.Equal(freetext, this.collection.Freetext[0]); + Assert.Equal(freetext, collection.Freetext[0]); } [Fact] public void TestItAddsEsePositions() { ControllerPosition esePosition = ControllerPositionFactory.Make(); - this.collection.Add(esePosition); + collection.Add(esePosition); - Assert.Equal(esePosition, this.collection.EsePositions[0]); + Assert.Equal(esePosition, collection.EsePositions[0]); } [Fact] public void TestItAddsSidRoutes() { SidStarRoute route = SidStarRouteFactory.Make(); - this.collection.Add(route); - Assert.Equal(route, this.collection.SidRoutes[0]); + collection.Add(route); + Assert.Equal(route, collection.SidRoutes[0]); } [Fact] public void TestItAddsStarRoutes() { SidStarRoute route = SidStarRouteFactory.Make(SidStarType.STAR); - this.collection.Add(route); - Assert.Equal(route, this.collection.StarRoutes[0]); + collection.Add(route); + Assert.Equal(route, collection.StarRoutes[0]); } [Fact] @@ -205,8 +205,8 @@ public void TestItAddsSectorlines() { Sectorline sectorline = SectorlineFactory.Make(); - this.collection.Add(sectorline); - Assert.Equal(sectorline, this.collection.SectorLines[0]); + collection.Add(sectorline); + Assert.Equal(sectorline, collection.SectorLines[0]); } [Fact] @@ -214,8 +214,8 @@ public void TestItAddsCircleSectorlines() { CircleSectorline sectorline = CircleSectorlineFactory.Make(); - this.collection.Add(sectorline); - Assert.Equal(sectorline, this.collection.CircleSectorLines[0]); + collection.Add(sectorline); + Assert.Equal(sectorline, collection.CircleSectorLines[0]); } [Fact] @@ -223,8 +223,8 @@ public void TestItAddsSectors() { Sector sector = SectorFactory.Make(); - this.collection.Add(sector); - Assert.Equal(sector, this.collection.Sectors[0]); + collection.Add(sector); + Assert.Equal(sector, collection.Sectors[0]); } [Fact] @@ -232,8 +232,8 @@ public void TestItAddsCoordinationPoints() { CoordinationPoint coordinationPoint = CoordinationPointFactory.Make(); - this.collection.Add(coordinationPoint); - Assert.Equal(coordinationPoint, this.collection.CoordinationPoints[0]); + collection.Add(coordinationPoint); + Assert.Equal(coordinationPoint, collection.CoordinationPoints[0]); } [Fact] @@ -242,7 +242,7 @@ public void TestItAddsRunwayCentrelines() RunwayCentreline centreline = RunwayCentrelineFactory.Make(); collection.Add(centreline); - Assert.Equal(centreline, this.collection.RunwayCentrelines[0]); + Assert.Equal(centreline, collection.RunwayCentrelines[0]); } [Fact] @@ -251,7 +251,16 @@ public void TestItAddsExtendedRunwayCentrelines() FixedColourRunwayCentreline centreline = FixedColourRunwayCentrelineFactory.Make(); collection.Add(centreline); - Assert.Equal(centreline, this.collection.FixedColourRunwayCentrelines[0]); + Assert.Equal(centreline, collection.FixedColourRunwayCentrelines[0]); + } + + [Fact] + public void TestItAddsGroundNetworks() + { + GroundNetwork network = GroundNetworkFactory.Make(); + collection.Add(network); + Assert.Single(collection.GroundNetworks); + Assert.Equal(network, collection.GroundNetworks[0]); } } } diff --git a/tests/CompilerTest/Output/EseOutputTest.cs b/tests/CompilerTest/Output/EseOutputTest.cs index f7f60d01..30ead6f0 100644 --- a/tests/CompilerTest/Output/EseOutputTest.cs +++ b/tests/CompilerTest/Output/EseOutputTest.cs @@ -22,6 +22,7 @@ public void TestItHasOutputSections() OutputSectionKeys.ESE_FREETEXT, OutputSectionKeys.ESE_SIDSSTARS, OutputSectionKeys.ESE_AIRSPACE, + OutputSectionKeys.ESE_GROUND_NETWORK }; Assert.Equal(expected, output.GetOutputSections()); diff --git a/tests/CompilerTest/Output/OutputSectionsConfigTest.cs b/tests/CompilerTest/Output/OutputSectionsConfigTest.cs index d933cd3c..454d4a71 100644 --- a/tests/CompilerTest/Output/OutputSectionsConfigTest.cs +++ b/tests/CompilerTest/Output/OutputSectionsConfigTest.cs @@ -8,7 +8,7 @@ public class OutputSectionsConfigTest [Fact] public void TestItHasCorrectNumberOfSections() { - Assert.Equal(23, OutputSectionsConfig.Sections.Length); + Assert.Equal(24, OutputSectionsConfig.Sections.Length); } [Theory] @@ -34,7 +34,8 @@ public void TestItHasCorrectNumberOfSections() [InlineData(19, OutputSectionKeys.ESE_FREETEXT, false, "[FREETEXT]")] [InlineData(20, OutputSectionKeys.ESE_SIDSSTARS, true, "[SIDSSTARS]")] [InlineData(21, OutputSectionKeys.ESE_AIRSPACE, true, "[AIRSPACE]")] - [InlineData(22, OutputSectionKeys.RWY_ACTIVE_RUNWAYS, false, null)] + [InlineData(22, OutputSectionKeys.ESE_GROUND_NETWORK, true, "[GROUND]")] + [InlineData(23, OutputSectionKeys.RWY_ACTIVE_RUNWAYS, false, null)] public void TestConfig(int index, OutputSectionKeys expectedKey, bool expectedPrintGroupings, string expectedHeader) { Assert.Equal( diff --git a/tests/CompilerTest/Parser/AbstractParserTestCase.cs b/tests/CompilerTest/Parser/AbstractParserTestCase.cs index b1e06295..2c009c2d 100644 --- a/tests/CompilerTest/Parser/AbstractParserTestCase.cs +++ b/tests/CompilerTest/Parser/AbstractParserTestCase.cs @@ -19,20 +19,20 @@ public abstract class AbstractParserTestCase protected AbstractParserTestCase() { - this.logger = new Moq.Mock(); - this.sectorElementCollection = new SectorElementCollection(); + logger = new Moq.Mock(); + sectorElementCollection = new SectorElementCollection(); } private AbstractSectorDataFile GetInputFile(List lines) { return SectorDataFileFactoryFactory.Make(lines) - .Create(this.inputFileName, GetInputDataType()); + .Create(inputFileName, GetInputDataType()); } protected void RunParserOnLines(List lines) { - AbstractSectorDataFile file = this.GetInputFile(lines); - new DataParserFactory(this.sectorElementCollection, this.logger.Object).GetParserForFile(file).ParseData(file); + AbstractSectorDataFile file = GetInputFile(lines); + new DataParserFactory(sectorElementCollection, logger.Object).GetParserForFile(file).ParseData(file); } [SuppressMessage("ReSharper", "ParameterOnlyUsedForPreconditionCheck.Local")] @@ -59,7 +59,7 @@ protected void AssertExpectedMetadata( // ReSharper disable once ParameterOnlyUsedForPreconditionCheck.Local private void AssertExpectedDefinition(Definition definition, int lineNumber) { - Assert.Equal(new Definition(this.inputFileName, lineNumber), definition); + Assert.Equal(new Definition(inputFileName, lineNumber), definition); } private static void AssertExpectedDocblockLines(Docblock docblock, List docblockLines) @@ -72,7 +72,7 @@ private static void AssertExpectedDocblockLines(Docblock docblock, List protected void SetInputFileName(string filename) { - this.inputFileName = filename; + inputFileName = filename; } } } diff --git a/tests/CompilerTest/Parser/ActiveRunwayParserTest.cs b/tests/CompilerTest/Parser/ActiveRunwayParserTest.cs index ab95f9ce..206eb5f9 100644 --- a/tests/CompilerTest/Parser/ActiveRunwayParserTest.cs +++ b/tests/CompilerTest/Parser/ActiveRunwayParserTest.cs @@ -23,34 +23,34 @@ public class ActiveRunwayParserTest: AbstractParserTestCase [MemberData(nameof(BadData))] public void ItRaisesSyntaxErrorsOnBadData(List lines) { - this.RunParserOnLines(lines); + RunParserOnLines(lines); - Assert.Empty(this.sectorElementCollection.ActiveRunways); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Empty(sectorElementCollection.ActiveRunways); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItAddsDataInMode0() { - this.RunParserOnLines(new List(new[] { "ACTIVE_RUNWAY:EGHI:20:0 ;comment" })); + RunParserOnLines(new List(new[] { "ACTIVE_RUNWAY:EGHI:20:0 ;comment" })); - ActiveRunway result = this.sectorElementCollection.ActiveRunways[0]; + ActiveRunway result = sectorElementCollection.ActiveRunways[0]; Assert.Equal("EGHI", result.Airfield); Assert.Equal("20", result.Identifier); Assert.Equal(0, result.Mode); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); } [Fact] public void TestItAddsDataInMode1() { - this.RunParserOnLines(new List(new[] { "ACTIVE_RUNWAY:EGHI:20:1 ;comment" })); + RunParserOnLines(new List(new[] { "ACTIVE_RUNWAY:EGHI:20:1 ;comment" })); - ActiveRunway result = this.sectorElementCollection.ActiveRunways[0]; + ActiveRunway result = sectorElementCollection.ActiveRunways[0]; Assert.Equal("EGHI", result.Airfield); Assert.Equal("20", result.Identifier); Assert.Equal(1, result.Mode); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); } protected override InputDataType GetInputDataType() diff --git a/tests/CompilerTest/Parser/AirportParserTest.cs b/tests/CompilerTest/Parser/AirportParserTest.cs index d743f4a7..7dbe9a6f 100644 --- a/tests/CompilerTest/Parser/AirportParserTest.cs +++ b/tests/CompilerTest/Parser/AirportParserTest.cs @@ -11,7 +11,7 @@ public class AirportParserTest: AbstractParserTestCase { public AirportParserTest() { - this.SetInputFileName("EGHI/Basic.txt"); + SetInputFileName("EGHI/Basic.txt"); } public static IEnumerable BadData => new List @@ -42,37 +42,37 @@ public AirportParserTest() [MemberData(nameof(BadData))] public void ItRaisesSyntaxErrorsOnBadData(List lines) { - this.RunParserOnLines(lines); - Assert.Empty(this.sectorElementCollection.ActiveRunways); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + RunParserOnLines(lines); + Assert.Empty(sectorElementCollection.ActiveRunways); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void ItRaisesSyntaxErrorOnBadFolderName() { - this.SetInputFileName("1234/Basic.txt"); - this.RunParserOnLines(new List{ + SetInputFileName("1234/Basic.txt"); + RunParserOnLines(new List{ "Southampton; comment1", "N050.57.00.000 W001.21.24.490 ;comment2", "120.220 ;comment3" }); - Assert.Empty(this.sectorElementCollection.ActiveRunways); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Empty(sectorElementCollection.ActiveRunways); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItAddsAirportData() { - this.RunParserOnLines( + RunParserOnLines( new List(new[] {"Southampton; comment1", "N050.57.00.000 W001.21.24.490 ;comment2", "120.220 ;comment3" }) ); - Airport result = this.sectorElementCollection.Airports[0]; + Airport result = sectorElementCollection.Airports[0]; Assert.Equal("Southampton", result.Name); Assert.Equal("EGHI", result.Icao); Assert.Equal("120.220", result.Frequency); Assert.Equal(new Coordinate("N050.57.00.000", "W001.21.24.490"), result.LatLong); - this.AssertExpectedMetadata(result, commentString: "comment1"); + AssertExpectedMetadata(result, commentString: "comment1"); } protected override InputDataType GetInputDataType() diff --git a/tests/CompilerTest/Parser/AirwayParserTest.cs b/tests/CompilerTest/Parser/AirwayParserTest.cs index 23fe4de7..4d6241db 100644 --- a/tests/CompilerTest/Parser/AirwayParserTest.cs +++ b/tests/CompilerTest/Parser/AirwayParserTest.cs @@ -29,37 +29,37 @@ public class AirwayParserTest: AbstractParserTestCase [MemberData(nameof(BadData))] public void ItRaisesSyntaxErrorsOnBadData(List lines) { - this.RunParserOnLines(lines); + RunParserOnLines(lines); - Assert.Empty(this.sectorElementCollection.HighAirways); - Assert.Empty(this.sectorElementCollection.LowAirways); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Empty(sectorElementCollection.HighAirways); + Assert.Empty(sectorElementCollection.LowAirways); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItAddsAirwayData() { - this.RunParserOnLines(new List(new[] { "N050.57.00.001 W001.21.24.490 N050.57.00.002 W001.21.24.490;comment" })); + RunParserOnLines(new List(new[] { "N050.57.00.001 W001.21.24.490 N050.57.00.002 W001.21.24.490;comment" })); - AirwaySegment result = this.sectorElementCollection.LowAirways[0]; + AirwaySegment result = sectorElementCollection.LowAirways[0]; Assert.Equal("TEST", result.Identifier); Assert.Equal(AirwayType.LOW, result.Type); Assert.Equal(new Point(new Coordinate("N050.57.00.001", "W001.21.24.490")), result.StartPoint); Assert.Equal(new Point(new Coordinate("N050.57.00.002", "W001.21.24.490")), result.EndPoint); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); } [Fact] public void TestItAddsAirwayDataWithIdentifiers() { - this.RunParserOnLines(new List(new[] { "DIKAS DIKAS BHD BHD;comment" })); + RunParserOnLines(new List(new[] { "DIKAS DIKAS BHD BHD;comment" })); - AirwaySegment result = this.sectorElementCollection.LowAirways[0]; + AirwaySegment result = sectorElementCollection.LowAirways[0]; Assert.Equal("TEST", result.Identifier); Assert.Equal(AirwayType.LOW, result.Type); Assert.Equal(new Point("DIKAS"), result.StartPoint); Assert.Equal(new Point("BHD"), result.EndPoint); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); } protected override InputDataType GetInputDataType() diff --git a/tests/CompilerTest/Parser/ArtccParserTest.cs b/tests/CompilerTest/Parser/ArtccParserTest.cs index b2ac895a..8f96c3b1 100644 --- a/tests/CompilerTest/Parser/ArtccParserTest.cs +++ b/tests/CompilerTest/Parser/ArtccParserTest.cs @@ -26,42 +26,42 @@ public class ArtccParserTest: AbstractParserTestCase [MemberData(nameof(BadData))] public void ItRaisesSyntaxErrorsOnBadData(List lines) { - this.RunParserOnLines(lines); + RunParserOnLines(lines); - Assert.Empty(this.sectorElementCollection.Artccs); - Assert.Empty(this.sectorElementCollection.HighArtccs); - Assert.Empty(this.sectorElementCollection.LowArtccs); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Empty(sectorElementCollection.Artccs); + Assert.Empty(sectorElementCollection.HighArtccs); + Assert.Empty(sectorElementCollection.LowArtccs); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItAddsArtccData() { - this.RunParserOnLines( + RunParserOnLines( new List(new[] { "EGTT London FIR N050.57.00.001 W001.21.24.490 N050.57.00.002 W001.21.24.490;comment" }) ); - ArtccSegment result = this.sectorElementCollection.Artccs[0]; + ArtccSegment result = sectorElementCollection.Artccs[0]; Assert.Equal("EGTT London FIR", result.Identifier); Assert.Equal(ArtccType.REGULAR, result.Type); Assert.Equal(new Point(new Coordinate("N050.57.00.001", "W001.21.24.490")), result.StartPoint); Assert.Equal(new Point(new Coordinate("N050.57.00.002", "W001.21.24.490")), result.EndPoint); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); } [Fact] public void TestItAddsArtccDataWithIdentifiers() { - this.RunParserOnLines( + RunParserOnLines( new List(new[] { "EGTT London FIR DIKAS DIKAS BHD BHD;comment" }) ); - ArtccSegment result = this.sectorElementCollection.Artccs[0]; + ArtccSegment result = sectorElementCollection.Artccs[0]; Assert.Equal("EGTT London FIR", result.Identifier); Assert.Equal(ArtccType.REGULAR, result.Type); Assert.Equal(new Point("DIKAS"), result.StartPoint); Assert.Equal(new Point("BHD"), result.EndPoint); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); } protected override InputDataType GetInputDataType() diff --git a/tests/CompilerTest/Parser/ColourParserTest.cs b/tests/CompilerTest/Parser/ColourParserTest.cs index 0252d3a6..90a944d7 100644 --- a/tests/CompilerTest/Parser/ColourParserTest.cs +++ b/tests/CompilerTest/Parser/ColourParserTest.cs @@ -29,21 +29,21 @@ public class ColourParserTest: AbstractParserTestCase [MemberData(nameof(BadData))] public void ItRaisesSyntaxErrorsOnBadData(List lines) { - this.RunParserOnLines(lines); + RunParserOnLines(lines); - Assert.Empty(this.sectorElementCollection.Colours); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Empty(sectorElementCollection.Colours); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItAddsColourData() { - this.RunParserOnLines(new List(new[] {"#define abc 255 ;comment"})); + RunParserOnLines(new List(new[] {"#define abc 255 ;comment"})); - Colour result = this.sectorElementCollection.Colours[0]; + Colour result = sectorElementCollection.Colours[0]; Assert.Equal("abc", result.Name); Assert.Equal(255, result.Value); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); } protected override InputDataType GetInputDataType() diff --git a/tests/CompilerTest/Parser/CoordinationPointParserTest.cs b/tests/CompilerTest/Parser/CoordinationPointParserTest.cs index 47cf418e..4fc8a2a3 100644 --- a/tests/CompilerTest/Parser/CoordinationPointParserTest.cs +++ b/tests/CompilerTest/Parser/CoordinationPointParserTest.cs @@ -50,10 +50,10 @@ public class CoordinationPointParserTest: AbstractParserTestCase [MemberData(nameof(BadData))] public void ItRaisesSyntaxErrorsOnBadData(List lines) { - this.RunParserOnLines(lines); + RunParserOnLines(lines); - Assert.Empty(this.sectorElementCollection.CoordinationPoints); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Empty(sectorElementCollection.CoordinationPoints); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Theory] @@ -80,9 +80,9 @@ public void ItRaisesSyntaxErrorsOnBadData(List lines) ] // Climb unspecified, descend unspecified public void TestItAddsInternalCoordinationPoints(string line, string climbLevel, string descendLevel) { - this.RunParserOnLines(new List {line}); + RunParserOnLines(new List {line}); - CoordinationPoint result = this.sectorElementCollection.CoordinationPoints[0]; + CoordinationPoint result = sectorElementCollection.CoordinationPoints[0]; Assert.False(result.IsFirCopx); Assert.Equal(CoordinationPoint.DataNotSpecified, result.DepartureAirportOrFixBefore); Assert.Equal(CoordinationPoint.DataNotSpecified, result.DepartureRunway); @@ -94,17 +94,17 @@ public void TestItAddsInternalCoordinationPoints(string line, string climbLevel, Assert.Equal(climbLevel, result.ClimbLevel); Assert.Equal(descendLevel, result.DescendLevel); Assert.Equal("|HEMEL20", result.Name); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); } [Fact] public void TestItAddsFirCoordinationPoints() { - this.RunParserOnLines( + RunParserOnLines( new List(new[] { "FIR_COPX:*:*:HEMEL:EGBB:*:London AC Worthing:London AC Dover:*:25000:|HEMEL20 ;comment" }) ); - CoordinationPoint result = this.sectorElementCollection.CoordinationPoints[0]; + CoordinationPoint result = sectorElementCollection.CoordinationPoints[0]; Assert.True(result.IsFirCopx); Assert.Equal(CoordinationPoint.DataNotSpecified, result.DepartureAirportOrFixBefore); Assert.Equal(CoordinationPoint.DataNotSpecified, result.DepartureRunway); @@ -116,7 +116,7 @@ public void TestItAddsFirCoordinationPoints() Assert.Equal(CoordinationPoint.DataNotSpecified, result.ClimbLevel); Assert.Equal("25000", result.DescendLevel); Assert.Equal("|HEMEL20", result.Name); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); } protected override InputDataType GetInputDataType() diff --git a/tests/CompilerTest/Parser/DataParserFactoryTest.cs b/tests/CompilerTest/Parser/DataParserFactoryTest.cs index 86c26d78..27d16335 100644 --- a/tests/CompilerTest/Parser/DataParserFactoryTest.cs +++ b/tests/CompilerTest/Parser/DataParserFactoryTest.cs @@ -16,7 +16,7 @@ public class DataParserFactoryTest public DataParserFactoryTest() { - this.factory = new DataParserFactory(new SectorElementCollection(), new Mock().Object); + factory = new DataParserFactory(new SectorElementCollection(), new Mock().Object); } [Theory] @@ -40,6 +40,7 @@ public DataParserFactoryTest() [InlineData(InputDataType.ESE_POSITIONS, typeof(EsePositionParser))] [InlineData(InputDataType.ESE_POSITIONS_MENTOR, typeof(EsePositionParser))] [InlineData(InputDataType.ESE_FREETEXT, typeof(FreetextParser))] + [InlineData(InputDataType.ESE_GROUND_NETWORK, typeof(GroundNetworkParser))] [InlineData(InputDataType.ESE_SIDS, typeof(SidStarParser))] [InlineData(InputDataType.ESE_STARS, typeof(SidStarParser))] [InlineData(InputDataType.ESE_SECTORLINES, typeof(SectorlineParser))] @@ -53,7 +54,7 @@ public void TestItReturnsCorrectParser(InputDataType dataType, Type expectedPars { Assert.Equal( expectedParserType, - this.factory.GetParserForFile( + factory.GetParserForFile( SectorDataFileFactoryFactory.Make(new List()).Create("Test", dataType) ).GetType() ); diff --git a/tests/CompilerTest/Parser/EsePositionParserTest.cs b/tests/CompilerTest/Parser/EsePositionParserTest.cs index de3be9d5..05eb76aa 100644 --- a/tests/CompilerTest/Parser/EsePositionParserTest.cs +++ b/tests/CompilerTest/Parser/EsePositionParserTest.cs @@ -12,14 +12,14 @@ public class EsePositionParserTest: AbstractParserTestCase [Fact] public void TestItAddsPositionData() { - this.RunParserOnLines(new List() {"LON_CTR:London Control:127.820:L:9:LON:CTR:-:-:0301:0377:N051.32.26.870:W002.43.29.830:N051.32.26.871:W002.43.29.831:N051.32.26.872:W002.43.29.832:N051.32.26.873:W002.43.29.833 ;comment"}); + RunParserOnLines(new List() {"LON_CTR:London Control:127.820:L:9:LON:CTR:-:-:0301:0377:N051.32.26.870:W002.43.29.830:N051.32.26.871:W002.43.29.831:N051.32.26.872:W002.43.29.832:N051.32.26.873:W002.43.29.833 ;comment"}); List coordinateList = new(); coordinateList.Add(new Coordinate("N051.32.26.870", "W002.43.29.830")); coordinateList.Add(new Coordinate("N051.32.26.871", "W002.43.29.831")); coordinateList.Add(new Coordinate("N051.32.26.872", "W002.43.29.832")); coordinateList.Add(new Coordinate("N051.32.26.873", "W002.43.29.833")); - ControllerPosition position = this.sectorElementCollection.EsePositions[0]; + ControllerPosition position = sectorElementCollection.EsePositions[0]; Assert.Equal("LON_CTR", position.Callsign); Assert.Equal("London Control", position.RtfCallsign); Assert.Equal("127.820", position.Frequency); @@ -30,17 +30,17 @@ public void TestItAddsPositionData() Assert.Equal("0301", position.SquawkRangeStart); Assert.Equal("0377", position.SquawkRangeEnd); Assert.Equal(coordinateList, position.VisCentres); - this.AssertExpectedMetadata(position); + AssertExpectedMetadata(position); } [Fact] public void TestItAddsPositionDataSkippedCenters() { - this.RunParserOnLines(new List() {"LON_CTR:London Control:127.820:L:9:LON:CTR:-:-:0301:0377:N051.32.26.870:W002.43.29.830:::::: ;comment"}); + RunParserOnLines(new List() {"LON_CTR:London Control:127.820:L:9:LON:CTR:-:-:0301:0377:N051.32.26.870:W002.43.29.830:::::: ;comment"}); List coordinateList = new(); coordinateList.Add(new Coordinate("N051.32.26.870", "W002.43.29.830")); - ControllerPosition position = this.sectorElementCollection.EsePositions[0]; + ControllerPosition position = sectorElementCollection.EsePositions[0]; Assert.Equal("LON_CTR", position.Callsign); Assert.Equal("London Control", position.RtfCallsign); Assert.Equal("127.820", position.Frequency); @@ -51,17 +51,17 @@ public void TestItAddsPositionDataSkippedCenters() Assert.Equal("0301", position.SquawkRangeStart); Assert.Equal("0377", position.SquawkRangeEnd); Assert.Equal(coordinateList, position.VisCentres); - this.AssertExpectedMetadata(position); + AssertExpectedMetadata(position); } [Fact] public void TestItAddsPositionDataSkippedSquawks() { - this.RunParserOnLines(new List() {"LON_CTR:London Control:127.820:L:9:LON:CTR:-:-::-:N051.32.26.870:W002.43.29.830 ;comment"}); + RunParserOnLines(new List() {"LON_CTR:London Control:127.820:L:9:LON:CTR:-:-::-:N051.32.26.870:W002.43.29.830 ;comment"}); List coordinateList = new(); coordinateList.Add(new Coordinate("N051.32.26.870", "W002.43.29.830")); - ControllerPosition position = this.sectorElementCollection.EsePositions[0]; + ControllerPosition position = sectorElementCollection.EsePositions[0]; Assert.Equal("LON_CTR", position.Callsign); Assert.Equal("London Control", position.RtfCallsign); Assert.Equal("127.820", position.Frequency); @@ -152,10 +152,10 @@ public void TestItAddsPositionDataSkippedSquawks() [MemberData(nameof(BadData))] public void ItRaisesSyntaxErrorsOnBadData(List lines) { - this.RunParserOnLines(lines); + RunParserOnLines(lines); - Assert.Empty(this.sectorElementCollection.EsePositions); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Empty(sectorElementCollection.EsePositions); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } protected override InputDataType GetInputDataType() diff --git a/tests/CompilerTest/Parser/EuroScopeNoFrequencyParser.cs b/tests/CompilerTest/Parser/EuroScopeNoFrequencyParser.cs index 380e2f1c..29486218 100644 --- a/tests/CompilerTest/Parser/EuroScopeNoFrequencyParser.cs +++ b/tests/CompilerTest/Parser/EuroScopeNoFrequencyParser.cs @@ -9,7 +9,7 @@ public class EuroScopeNoFrequencyParserTest public EuroScopeNoFrequencyParserTest() { - this.parser = new EuroscopeNoFrequencyParser(); + parser = new EuroscopeNoFrequencyParser(); } [Fact] diff --git a/tests/CompilerTest/Parser/FixParserTest.cs b/tests/CompilerTest/Parser/FixParserTest.cs index 016775b5..7196feaf 100644 --- a/tests/CompilerTest/Parser/FixParserTest.cs +++ b/tests/CompilerTest/Parser/FixParserTest.cs @@ -26,21 +26,21 @@ public class FixParserTest: AbstractParserTestCase [MemberData(nameof(BadData))] public void ItRaisesSyntaxErrorsOnBadData(List lines) { - this.RunParserOnLines(lines); + RunParserOnLines(lines); - Assert.Empty(this.sectorElementCollection.Fixes); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Empty(sectorElementCollection.Fixes); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItAddsFixData() { - this.RunParserOnLines(new List() {"ABCDE N050.57.00.000 W001.21.24.490;comment"}); + RunParserOnLines(new List() {"ABCDE N050.57.00.000 W001.21.24.490;comment"}); - Fix result = this.sectorElementCollection.Fixes[0]; + Fix result = sectorElementCollection.Fixes[0]; Assert.Equal("ABCDE", result.Identifier); Assert.Equal(new Coordinate("N050.57.00.000", "W001.21.24.490"), result.Coordinate); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); } protected override InputDataType GetInputDataType() diff --git a/tests/CompilerTest/Parser/FreetextParserTest.cs b/tests/CompilerTest/Parser/FreetextParserTest.cs index 00827a44..ce5e069e 100644 --- a/tests/CompilerTest/Parser/FreetextParserTest.cs +++ b/tests/CompilerTest/Parser/FreetextParserTest.cs @@ -12,31 +12,31 @@ public class FreetextParserTest: AbstractParserTestCase [Fact] public void TestItRaisesASyntaxErrorIfIncorrectNumberOfSegments() { - this.RunParserOnLines(new List(new[] { "abc:def:ghi" })); + RunParserOnLines(new List(new[] { "abc:def:ghi" })); - Assert.Empty(this.sectorElementCollection.Fixes); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Empty(sectorElementCollection.Fixes); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItRaisesAnErrorIfInvalidCoordinate() { - this.RunParserOnLines(new List(new[] { "abc:def:Title:Text" })); + RunParserOnLines(new List(new[] { "abc:def:Title:Text" })); - Assert.Empty(this.sectorElementCollection.Fixes); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Empty(sectorElementCollection.Fixes); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItAddsFreetextData() { - this.RunParserOnLines(new List(new[] { "N054.28.46.319:W006.15.33.933:Title:Text ;comment" })); + RunParserOnLines(new List(new[] { "N054.28.46.319:W006.15.33.933:Title:Text ;comment" })); - Freetext result = this.sectorElementCollection.Freetext[0]; + Freetext result = sectorElementCollection.Freetext[0]; Assert.Equal(new Coordinate("N054.28.46.319", "W006.15.33.933"), result.Coordinate); Assert.Equal("Title", result.Title); Assert.Equal("Text", result.Text); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); } protected override InputDataType GetInputDataType() diff --git a/tests/CompilerTest/Parser/FrequencyParserTest.cs b/tests/CompilerTest/Parser/FrequencyParserTest.cs index 733e26f9..f31fbec8 100644 --- a/tests/CompilerTest/Parser/FrequencyParserTest.cs +++ b/tests/CompilerTest/Parser/FrequencyParserTest.cs @@ -9,7 +9,7 @@ public class FrequencyParserTest public FrequencyParserTest() { - this.parser = new FrequencyParser(117, 137, 50); + parser = new FrequencyParser(117, 137, 50); } [Theory] @@ -24,7 +24,7 @@ public FrequencyParserTest() [InlineData("135.150", "135.150")] // Everything ok public void TestItParsesFrequencies(string frequency, string expected) { - Assert.Equal(expected, this.parser.ParseFrequency(frequency)); + Assert.Equal(expected, parser.ParseFrequency(frequency)); } } } diff --git a/tests/CompilerTest/Parser/GeoParserTest.cs b/tests/CompilerTest/Parser/GeoParserTest.cs index 806d2d49..5988edd8 100644 --- a/tests/CompilerTest/Parser/GeoParserTest.cs +++ b/tests/CompilerTest/Parser/GeoParserTest.cs @@ -29,19 +29,19 @@ public class GeoParserTest: AbstractParserTestCase [MemberData(nameof(BadData))] public void ItRaisesSyntaxErrorsOnBadData(List lines) { - this.RunParserOnLines(lines); - Assert.Empty(this.sectorElementCollection.GeoElements); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + RunParserOnLines(lines); + Assert.Empty(sectorElementCollection.GeoElements); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItAddsGeoDataWithOneSegment() { - this.RunParserOnLines( + RunParserOnLines( new List(new[] { "TestGeo N050.57.00.000 W001.21.24.490 BCN BCN test ;comment" }) ); - Geo result = this.sectorElementCollection.GeoElements[0]; + Geo result = sectorElementCollection.GeoElements[0]; Assert.Equal( new Point(new Coordinate("N050.57.00.000", "W001.21.24.490")), result.FirstPoint @@ -55,13 +55,13 @@ public void TestItAddsGeoDataWithOneSegment() result.Colour ); Assert.Empty(result.AdditionalSegments); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); } [Fact] public void TestItAddsGeoDataWithMultipleSegment() { - this.RunParserOnLines( + RunParserOnLines( new List(new[] { "TestGeo N050.57.00.000 W001.21.24.490 BCN BCN test ;comment", @@ -70,7 +70,7 @@ public void TestItAddsGeoDataWithMultipleSegment() }) ); - Geo result = this.sectorElementCollection.GeoElements[0]; + Geo result = sectorElementCollection.GeoElements[0]; Assert.Equal( new Point(new Coordinate("N050.57.00.000", "W001.21.24.490")), result.FirstPoint @@ -83,7 +83,7 @@ public void TestItAddsGeoDataWithMultipleSegment() "test", result.Colour ); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); // Segment 1 Assert.Equal(2, result.AdditionalSegments.Count); @@ -99,7 +99,7 @@ public void TestItAddsGeoDataWithMultipleSegment() "test2", result.AdditionalSegments[0].Colour ); - this.AssertExpectedMetadata(result.AdditionalSegments[0], 2, "comment1"); + AssertExpectedMetadata(result.AdditionalSegments[0], 2, "comment1"); // Segment 2 Assert.Equal( @@ -114,17 +114,17 @@ public void TestItAddsGeoDataWithMultipleSegment() "test3", result.AdditionalSegments[1].Colour ); - this.AssertExpectedMetadata(result.AdditionalSegments[1], 3, "comment2"); + AssertExpectedMetadata(result.AdditionalSegments[1], 3, "comment2"); } [Fact] public void TestItAddsFakePoint() { - this.RunParserOnLines( + RunParserOnLines( new List(new[] { "TestGeo S999.00.00.000 E999.00.00.000 S999.00.00.000 E999.00.00.000 ;comment" }) ); - Geo result = this.sectorElementCollection.GeoElements[0]; + Geo result = sectorElementCollection.GeoElements[0]; Assert.Equal( new Point(new Coordinate("S999.00.00.000", "E999.00.00.000")), result.FirstPoint @@ -134,7 +134,7 @@ public void TestItAddsFakePoint() result.SecondPoint ); Assert.Null(result.Colour); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); } protected override InputDataType GetInputDataType() diff --git a/tests/CompilerTest/Parser/GroundNetworkParserTest.cs b/tests/CompilerTest/Parser/GroundNetworkParserTest.cs new file mode 100644 index 00000000..57651552 --- /dev/null +++ b/tests/CompilerTest/Parser/GroundNetworkParserTest.cs @@ -0,0 +1,200 @@ +using System.Collections.Generic; +using Xunit; +using Moq; +using Compiler.Error; +using Compiler.Model; +using Compiler.Input; + +namespace CompilerTest.Parser +{ + public class GroundNetworkParserTest: AbstractParserTestCase + { + public static IEnumerable BadData => new List + { + new object[] { new List{ + "COORD:N054.39.27.000:W006.12.57.000" + }}, // Invalid data type + new object[] { new List{ + "EXIT:27L:N3W:LEFT:15:16" + }}, // Too many segments + new object[] { new List{ + "EXIT:27L:N3W:LEFT" + }}, // Too few segments + new object[] { new List{ + "EXIT:ABC:N3W:LEFT:15" + }}, // Invalid runway + new object[] { new List{ + "EXIT:27L:N3W:UP:15" + }}, // Invalid direction + new object[] { new List{ + "EXIT:27L:N3W:LEFT:abc" + }}, // Invalid speed + new object[] { new List{ + "EXIT:27L:N3W:LEFT:0" + }}, // Speed to low + new object[] { new List{ + "EXIT:27L:N3W:LEFT:-1" + }}, // Speed negative + new object[] { new List{ + "EXIT:27L:N3W:LEFT:15" + }}, // No coordinates for exit + new object[] { new List{ + "EXIT:27L:N3W:LEFT:15", + "COORD:N054.39.27.000:W006.12.57.000:def" + }}, // Too many COORD segments + new object[] { new List{ + "EXIT:27L:N3W:LEFT:15", + "COORD:N054.39.27.000" + }}, // To few COORD segments + new object[] { new List{ + "EXIT:27L:N3W:LEFT:15", + "NOTCOORD:N054.39.27.000:W006.12.57.000" + }}, // Not a coordinate declaration for exit + new object[] { new List{ + "EXIT:27L:N3W:LEFT:15", + "COORD:Nabc.39.27.000:W006.12.57.000" + }}, // COORD declaration invalid coordinates + new object[] { new List{ + "TAXI:A" + }}, // Too few TAXI segments + new object[] { new List{ + "TAXI:A:15:1:54L:abc" + }}, // Too many TAXI segments + new object[] { new List{ + "TAXI:A:a:1:54L" + }}, // Maximum speed invalid + new object[] { new List{ + "TAXI:A:a:0:54L" + }}, // Maximum speed too low + new object[] { new List{ + "TAXI:A:-1:1:54L" + }}, // Maximum speed negative + new object[] { new List{ + "TAXI:A:15:1:54L" + }}, // Too few TAXI segments + new object[] { new List{ + "TAXI:A:15:abc:54L" + }}, // Usage flag not integer + new object[] { new List{ + "TAXI:A:15:0:54L" + }}, // Usage flag too low + new object[] { new List{ + "TAXI:A:15:4:54L" + }}, // Usage flag too high + new object[] { new List{ + "TAXI:A:15:1:54L" + }}, // No coordinates + new object[] { new List{ + "EXIT:26L:A1:LEFT:15;comment", + "TAXI:A1:15:1:25L ;comment3", + "COORD:N050.57.00.000:W001.21.24.490 ;comment4", + "COORD:N050.57.00.000:W001.21.24.491 ;comment5" + }} // First declaration in multi-line bad + }; + + [Theory] + [MemberData(nameof(BadData))] + public void ItRaisesSyntaxErrorsOnBadData(List lines) + { + RunParserOnLines(lines); + + Assert.Empty(sectorElementCollection.GroundNetworks); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + } + + [Theory] + [InlineData("EXIT:26L:A1:LEFT:15;comment", "LEFT")] + [InlineData("EXIT:26L:A1:RIGHT:15;comment", "RIGHT")] + public void TestItAddsRunwayExits(string exitLine, string expectedDirection) + { + RunParserOnLines( + new List() + { + exitLine, + "COORD:N050.57.00.000:W001.21.24.490 ;comment1", + "COORD:N050.57.00.000:W001.21.24.491 ;comment2" + } + ); + + Assert.Single(sectorElementCollection.GroundNetworks); + Assert.Equal("TESTFOLDER", sectorElementCollection.GroundNetworks[0].Airport); + Assert.Single(sectorElementCollection.GroundNetworks[0].RunwayExits); + + GroundNetworkRunwayExit exit = sectorElementCollection.GroundNetworks[0].RunwayExits[0]; + Assert.Equal("26L", exit.Runway); + Assert.Equal("A1", exit.ExitName); + Assert.Equal(expectedDirection, exit.Direction); + Assert.Equal(15, exit.MaximumSpeed); + Assert.Equal(2, exit.Coordinates.Count); + Assert.Equal(new Coordinate("N050.57.00.000", "W001.21.24.490"), exit.Coordinates[0].Coordinate); + AssertExpectedMetadata(exit.Coordinates[0], 2, "comment1"); + Assert.Equal(new Coordinate("N050.57.00.000", "W001.21.24.491"), exit.Coordinates[1].Coordinate); + AssertExpectedMetadata(exit.Coordinates[1], 3, "comment2"); + AssertExpectedMetadata(exit); + } + + [Theory] + [InlineData("TAXI:A1:15:1:25L ;comment", "A1", 15, 1, "25L")] // All data present + [InlineData("TAXI:A1:15 ;comment", "A1", 15, null, null)] // No usage flag or gate + [InlineData("TAXI:A1:15:1 ;comment", "A1", 15, 1, null)] // No gate + [InlineData("TAXI:A1:15::25L ;comment", "A1", 15, null, "25L")] // Usage flag empty + [InlineData("TAXI:A1:15:1: ;comment", "A1", 15, 1, null)] // Gate empty + [InlineData("TAXI:A1:15:: ;comment", "A1", 15, null, null)] // Gate and usage flag empty + public void TestItAddsTaxiways( + string taxiwayLine, + string expectedName, + int expectedMaximumSpeed, + int? expectedUsageFlag, + string expectedGateName + ) { + RunParserOnLines( + new List + { + taxiwayLine, + "COORD:N050.57.00.000:W001.21.24.490 ;comment1", + "COORD:N050.57.00.000:W001.21.24.491 ;comment2" + } + ); + + Assert.Single(sectorElementCollection.GroundNetworks); + Assert.Equal("TESTFOLDER", sectorElementCollection.GroundNetworks[0].Airport); + Assert.Single(sectorElementCollection.GroundNetworks[0].Taxiways); + + GroundNetworkTaxiway taxiway = sectorElementCollection.GroundNetworks[0].Taxiways[0]; + Assert.Equal(expectedName, taxiway.Name); + Assert.Equal(expectedMaximumSpeed, taxiway.MaximumSpeed); + Assert.Equal(expectedUsageFlag, taxiway.UsageFlag); + Assert.Equal(expectedGateName, taxiway.GateName); + Assert.Equal(2, taxiway.Coordinates.Count); + Assert.Equal(new Coordinate("N050.57.00.000", "W001.21.24.490"), taxiway.Coordinates[0].Coordinate); + AssertExpectedMetadata(taxiway.Coordinates[0], 2, "comment1"); + Assert.Equal(new Coordinate("N050.57.00.000", "W001.21.24.491"), taxiway.Coordinates[1].Coordinate); + AssertExpectedMetadata(taxiway.Coordinates[1], 3, "comment2"); + AssertExpectedMetadata(taxiway); + } + + [Fact] + public void TestItAddsMultipleElements() + { + RunParserOnLines( + new List() + { + "EXIT:26L:A1:RIGHT:15;comment", + "COORD:N050.57.00.000:W001.21.24.490 ;comment1", + "COORD:N050.57.00.000:W001.21.24.491 ;comment2", + "TAXI:A1:15:1:25L ;comment3", + "COORD:N050.57.00.000:W001.21.24.490 ;comment4", + "COORD:N050.57.00.000:W001.21.24.491 ;comment5" + } + ); + Assert.Single(sectorElementCollection.GroundNetworks); + Assert.Single(sectorElementCollection.GroundNetworks[0].Taxiways); + Assert.Single(sectorElementCollection.GroundNetworks[0].RunwayExits); + } + + protected override InputDataType GetInputDataType() + { + return InputDataType.ESE_GROUND_NETWORK; + } + } +} diff --git a/tests/CompilerTest/Parser/HeaderParserTest.cs b/tests/CompilerTest/Parser/HeaderParserTest.cs index 8764af65..f6c005c9 100644 --- a/tests/CompilerTest/Parser/HeaderParserTest.cs +++ b/tests/CompilerTest/Parser/HeaderParserTest.cs @@ -12,17 +12,17 @@ public class HeaderParserTest: AbstractParserTestCase [Fact] public void TestItThrowsSyntaxErrorIfHasData() { - this.RunParserOnLines(new List(){"abc ;comment"}); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + RunParserOnLines(new List(){"abc ;comment"}); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItReadsHeaderData() { - this.RunParserOnLines(new List(){";comment1", ";comment2"}); + RunParserOnLines(new List(){";comment1", ";comment2"}); - Assert.Single(this.sectorElementCollection.FileHeaders); - Header header = this.sectorElementCollection.FileHeaders[0]; + Assert.Single(sectorElementCollection.FileHeaders); + Header header = sectorElementCollection.FileHeaders[0]; Assert.Equal("comment1", header.Lines[0].Line.CommentString); Assert.Equal("comment2", header.Lines[1].Line.CommentString); } diff --git a/tests/CompilerTest/Parser/HeadingParserTest.cs b/tests/CompilerTest/Parser/HeadingParserTest.cs new file mode 100644 index 00000000..b9b4f684 --- /dev/null +++ b/tests/CompilerTest/Parser/HeadingParserTest.cs @@ -0,0 +1,26 @@ +using Compiler.Parser; +using Xunit; + +namespace CompilerTest.Parser +{ + public class HeadingParserTest + { + [Theory] + [InlineData("360", 360, true)] + [InlineData("180", 180, true)] + [InlineData("001", 1, true)] + [InlineData("01", 1, true)] + [InlineData("1", 1, true)] + [InlineData("361", -1, false)] + [InlineData("000", -1, false)] + [InlineData("00", -1, false)] + [InlineData("0", -1, false)] + [InlineData("abc", -1, false)] + public void TestItTriesToParseHeadings(string heading, int expectedParsed, bool expectedReturn) + { + bool tryParseResult = HeadingParser.TryParse(heading, out int parsedHeadingResult); + Assert.Equal(expectedReturn, tryParseResult); + Assert.Equal(expectedParsed, parsedHeadingResult); + } + } +} \ No newline at end of file diff --git a/tests/CompilerTest/Parser/InfoParserTest.cs b/tests/CompilerTest/Parser/InfoParserTest.cs index a7c89851..d1965958 100644 --- a/tests/CompilerTest/Parser/InfoParserTest.cs +++ b/tests/CompilerTest/Parser/InfoParserTest.cs @@ -12,7 +12,7 @@ public class InfoParserTest: AbstractParserTestCase [Fact] public void TestItAddsInfoData() { - this.RunParserOnLines(new List(new[] { + RunParserOnLines(new List(new[] { "UK (EGTT and EGPX) {VERSION}", "LON_CTR", "EGLL", @@ -24,7 +24,7 @@ public void TestItAddsInfoData() "10", })); - Info result = this.sectorElementCollection.Info; + Info result = sectorElementCollection.Info; Assert.Equal("UK (EGTT and EGPX) {VERSION}", result.Name.Name); Assert.Equal("LON_CTR", result.Callsign.Callsign); Assert.Equal("EGLL", result.Airport.AirportIcao); @@ -120,10 +120,10 @@ public void TestItAddsInfoData() [MemberData(nameof(BadData))] public void ItRaisesSyntaxErrorsOnBadData(List lines) { - this.RunParserOnLines(lines); + RunParserOnLines(lines); - Assert.Null(this.sectorElementCollection.Info); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Null(sectorElementCollection.Info); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } protected override InputDataType GetInputDataType() diff --git a/tests/CompilerTest/Parser/LabelParserTest.cs b/tests/CompilerTest/Parser/LabelParserTest.cs index 2a6fc335..4ea2f02f 100644 --- a/tests/CompilerTest/Parser/LabelParserTest.cs +++ b/tests/CompilerTest/Parser/LabelParserTest.cs @@ -29,22 +29,22 @@ public class LabelParserTest: AbstractParserTestCase [MemberData(nameof(BadData))] public void ItRaisesSyntaxErrorsOnBadData(List lines) { - this.RunParserOnLines(lines); + RunParserOnLines(lines); - Assert.Empty(this.sectorElementCollection.Labels); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Empty(sectorElementCollection.Labels); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItAddsLabelData() { - this.RunParserOnLines(new List(new[] { "\"test label\" N050.57.00.000 W001.21.24.490 red ;comment" })); + RunParserOnLines(new List(new[] { "\"test label\" N050.57.00.000 W001.21.24.490 red ;comment" })); - Label result = this.sectorElementCollection.Labels[0]; + Label result = sectorElementCollection.Labels[0]; Assert.Equal("test label", result.Text); Assert.Equal(new Coordinate("N050.57.00.000", "W001.21.24.490"), result.Position); Assert.Equal("red", result.Colour); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); } protected override InputDataType GetInputDataType() diff --git a/tests/CompilerTest/Parser/NdbParserTest.cs b/tests/CompilerTest/Parser/NdbParserTest.cs index 99fa34ab..c0575728 100644 --- a/tests/CompilerTest/Parser/NdbParserTest.cs +++ b/tests/CompilerTest/Parser/NdbParserTest.cs @@ -35,22 +35,22 @@ public class NdbParserTest: AbstractParserTestCase [MemberData(nameof(BadData))] public void ItRaisesSyntaxErrorsOnBadData(List lines) { - this.RunParserOnLines(lines); + RunParserOnLines(lines); - Assert.Empty(this.sectorElementCollection.Ndbs); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Empty(sectorElementCollection.Ndbs); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItAddsNdbData() { - this.RunParserOnLines(new List(new[] { "CDF 388.500 N050.57.00.000 W001.21.24.490;comment" })); + RunParserOnLines(new List(new[] { "CDF 388.500 N050.57.00.000 W001.21.24.490;comment" })); - Ndb result = this.sectorElementCollection.Ndbs[0]; + Ndb result = sectorElementCollection.Ndbs[0]; Assert.Equal("CDF", result.Identifier); Assert.Equal("388.500", result.Frequency); Assert.Equal(new Coordinate("N050.57.00.000", "W001.21.24.490"), result.Coordinate); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); } protected override InputDataType GetInputDataType() diff --git a/tests/CompilerTest/Parser/RegionParserTest.cs b/tests/CompilerTest/Parser/RegionParserTest.cs index 50377ddc..411ac737 100644 --- a/tests/CompilerTest/Parser/RegionParserTest.cs +++ b/tests/CompilerTest/Parser/RegionParserTest.cs @@ -12,7 +12,7 @@ public class RegionParserTest : AbstractParserTestCase [Fact] public void TestItAddsSinglePointRegionData() { - this.RunParserOnLines( + RunParserOnLines( new List(new[] { "REGIONNAME TestRegion", @@ -20,20 +20,20 @@ public void TestItAddsSinglePointRegionData() }) ); - Region result = this.sectorElementCollection.Regions[0]; + Region result = sectorElementCollection.Regions[0]; Assert.Equal("TestRegion", result.Name); - this.AssertExpectedMetadata(result, commentString: ""); + AssertExpectedMetadata(result, commentString: ""); Assert.Single(result.Points); Assert.Equal("Red", result.Points[0].Colour); Assert.Equal(new Point("BCN"), result.Points[0].Point); - this.AssertExpectedMetadata(result.Points[0], 2); + AssertExpectedMetadata(result.Points[0], 2); } [Fact] public void TestItAddsMultipleLineRegionData() { - this.RunParserOnLines( + RunParserOnLines( new List(new[] { "REGIONNAME TestRegion ; comment", @@ -43,28 +43,28 @@ public void TestItAddsMultipleLineRegionData() }) ); - Region result = this.sectorElementCollection.Regions[0]; + Region result = sectorElementCollection.Regions[0]; Assert.Equal("TestRegion", result.Name); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); Assert.Equal(3, result.Points.Count); Assert.Equal("Red", result.Points[0].Colour); Assert.Equal(new Point("BCN"), result.Points[0].Point); - this.AssertExpectedMetadata(result.Points[0], 2); + AssertExpectedMetadata(result.Points[0], 2); Assert.Null(result.Points[1].Colour); Assert.Equal(new Point("BHD"), result.Points[1].Point); - this.AssertExpectedMetadata(result.Points[1], 3, ""); + AssertExpectedMetadata(result.Points[1], 3, ""); Assert.Null(result.Points[2].Colour); Assert.Equal(new Point("JSY"), result.Points[2].Point); - this.AssertExpectedMetadata(result.Points[2], 4, ""); + AssertExpectedMetadata(result.Points[2], 4, ""); } [Fact] public void TestItAddsMultipleRegionsData() { - this.RunParserOnLines( + RunParserOnLines( new List(new[] { "REGIONNAME TestRegion1", @@ -75,27 +75,27 @@ public void TestItAddsMultipleRegionsData() }) ); - Assert.Equal(2, this.sectorElementCollection.Regions.Count); - Region result1 = this.sectorElementCollection.Regions[0]; + Assert.Equal(2, sectorElementCollection.Regions.Count); + Region result1 = sectorElementCollection.Regions[0]; Assert.Equal("TestRegion1", result1.Name); - this.AssertExpectedMetadata(result1, 1, ""); + AssertExpectedMetadata(result1, 1, ""); Assert.Equal(2, result1.Points.Count); Assert.Equal("Red", result1.Points[0].Colour); Assert.Equal(new Point("BCN"), result1.Points[0].Point); - this.AssertExpectedMetadata(result1.Points[0], 2); + AssertExpectedMetadata(result1.Points[0], 2); Assert.Equal(new Point("BHD"), result1.Points[1].Point); - this.AssertExpectedMetadata(result1.Points[1], 3, ""); + AssertExpectedMetadata(result1.Points[1], 3, ""); - Region result2 = this.sectorElementCollection.Regions[1]; + Region result2 = sectorElementCollection.Regions[1]; Assert.Equal("TestRegion2", result2.Name); - this.AssertExpectedMetadata(result2, 4, ""); + AssertExpectedMetadata(result2, 4, ""); Assert.Single(result2.Points); Assert.Equal(new Point("JSY"), result2.Points[0].Point); Assert.Equal("White", result2.Points[0].Colour); - this.AssertExpectedMetadata(result2.Points[0], 5, ""); + AssertExpectedMetadata(result2.Points[0], 5, ""); } public static IEnumerable BadData => new List @@ -162,10 +162,10 @@ public void TestItAddsMultipleRegionsData() [MemberData(nameof(BadData))] public void ItRaisesSyntaxErrorsOnBadData(List lines) { - this.RunParserOnLines(lines); + RunParserOnLines(lines); - Assert.Empty(this.sectorElementCollection.Regions); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Empty(sectorElementCollection.Regions); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } protected override InputDataType GetInputDataType() diff --git a/tests/CompilerTest/Parser/RunwayParserTest.cs b/tests/CompilerTest/Parser/RunwayParserTest.cs index 4c70edaf..c4687a01 100644 --- a/tests/CompilerTest/Parser/RunwayParserTest.cs +++ b/tests/CompilerTest/Parser/RunwayParserTest.cs @@ -38,18 +38,18 @@ public class RunwayParserTest: AbstractParserTestCase [MemberData(nameof(BadData))] public void ItRaisesSyntaxErrorsOnBadData(List lines) { - this.RunParserOnLines(lines); + RunParserOnLines(lines); - Assert.Empty(this.sectorElementCollection.Runways); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Empty(sectorElementCollection.Runways); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItAddsRunwayDataWithDescription() { - this.RunParserOnLines(new List(new[] { "15 33 148 328 N052.27.48.520 W001.45.31.430 N052.26.46.580 W001.44.22.560 ;comment" })); + RunParserOnLines(new List(new[] { "15 33 148 328 N052.27.48.520 W001.45.31.430 N052.26.46.580 W001.44.22.560 ;comment" })); - Runway result = this.sectorElementCollection.Runways[0]; + Runway result = sectorElementCollection.Runways[0]; Assert.Equal("15", result.FirstIdentifier); Assert.Equal(148, result.FirstHeading); Assert.Equal(new Coordinate("N052.27.48.520", "W001.45.31.430"), result.FirstThreshold); @@ -57,7 +57,7 @@ public void TestItAddsRunwayDataWithDescription() Assert.Equal(328, result.ReverseHeading); Assert.Equal(new Coordinate("N052.26.46.580", "W001.44.22.560"), result.ReverseThreshold); Assert.Equal("TESTFOLDER", result.AirfieldIcao); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); } protected override InputDataType GetInputDataType() diff --git a/tests/CompilerTest/Parser/SectorParserTest.cs b/tests/CompilerTest/Parser/SectorParserTest.cs index 793adabb..525a09e1 100644 --- a/tests/CompilerTest/Parser/SectorParserTest.cs +++ b/tests/CompilerTest/Parser/SectorParserTest.cs @@ -221,16 +221,16 @@ public class SectorParserTest : AbstractParserTestCase [MemberData(nameof(BadData))] public void ItRaisesSyntaxErrorsOnBadData(List lines) { - this.RunParserOnLines(lines); + RunParserOnLines(lines); - Assert.Empty(this.sectorElementCollection.Sectors); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Empty(sectorElementCollection.Sectors); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItAddsData() { - this.RunParserOnLines( + RunParserOnLines( new List(new[] { "SECTOR:AAFIN:100:6000 ;comment1", "OWNER:AAF:AAR:STA ;comment2", @@ -258,18 +258,18 @@ public void TestItAddsData() ); // First - base data - Sector result1 = this.sectorElementCollection.Sectors[0]; + Sector result1 = sectorElementCollection.Sectors[0]; Assert.Equal("AAFIN", result1.Name); Assert.Equal(100, result1.MinimumAltitude); Assert.Equal(6000, result1.MaximumAltitude); - this.AssertExpectedMetadata(result1, 1, "comment1"); + AssertExpectedMetadata(result1, 1, "comment1"); // First - OWNER Assert.Equal(3, result1.Owners.Owners.Count); Assert.Equal("AAF", result1.Owners.Owners[0]); Assert.Equal("AAR", result1.Owners.Owners[1]); Assert.Equal("STA", result1.Owners.Owners[2]); - this.AssertExpectedMetadata(result1.Owners, 2, "comment2"); + AssertExpectedMetadata(result1.Owners, 2, "comment2"); // First - ALTOWNER 1 Assert.Equal(2, result1.AltOwners.Count); @@ -278,101 +278,101 @@ public void TestItAddsData() Assert.Equal("SW", result1.AltOwners[0].Owners[0]); Assert.Equal("SWD", result1.AltOwners[0].Owners[1]); Assert.Equal("S", result1.AltOwners[0].Owners[2]); - this.AssertExpectedMetadata(result1.AltOwners[0], 3, "comment3"); + AssertExpectedMetadata(result1.AltOwners[0], 3, "comment3"); // First - ALTOWNER 2 Assert.Equal("AAWHAT2", result1.AltOwners[1].Name); Assert.Single(result1.AltOwners[1].Owners); Assert.Equal("S", result1.AltOwners[1].Owners[0]); - this.AssertExpectedMetadata(result1.AltOwners[1], 4, "comment3.1"); + AssertExpectedMetadata(result1.AltOwners[1], 4, "comment3.1"); // First - BORDER Assert.Single(result1.Borders); Assert.Equal(2, result1.Borders[0].BorderLines.Count); Assert.Equal("AAFIN", result1.Borders[0].BorderLines[0]); Assert.Equal("AAWHAT", result1.Borders[0].BorderLines[1]); - this.AssertExpectedMetadata(result1.Borders[0], 5, "comment4"); + AssertExpectedMetadata(result1.Borders[0], 5, "comment4"); // First - ARRAPT 1 Assert.Equal(2, result1.ArrivalAirports.Count); Assert.Equal(2, result1.ArrivalAirports[0].Airports.Count); Assert.Equal("EGAA", result1.ArrivalAirports[0].Airports[0]); Assert.Equal("EGAC", result1.ArrivalAirports[0].Airports[1]); - this.AssertExpectedMetadata(result1.ArrivalAirports[0], 6, "comment5"); + AssertExpectedMetadata(result1.ArrivalAirports[0], 6, "comment5"); // First - ARRAPT 2 Assert.Single(result1.ArrivalAirports[1].Airports); Assert.Equal("EGAE", result1.ArrivalAirports[1].Airports[0]); - this.AssertExpectedMetadata(result1.ArrivalAirports[1], 7, "comment5.1"); + AssertExpectedMetadata(result1.ArrivalAirports[1], 7, "comment5.1"); // First - DEPAPT 1 Assert.Equal(2, result1.DepartureAirports.Count); Assert.Equal(2, result1.DepartureAirports[0].Airports.Count); Assert.Equal("EGKK", result1.DepartureAirports[0].Airports[0]); Assert.Equal("EGLL", result1.DepartureAirports[0].Airports[1]); - this.AssertExpectedMetadata(result1.DepartureAirports[0], 8, "comment6"); + AssertExpectedMetadata(result1.DepartureAirports[0], 8, "comment6"); // First - DEPAPT 2 Assert.Single(result1.DepartureAirports[1].Airports); Assert.Equal("EGLC", result1.DepartureAirports[1].Airports[0]); - this.AssertExpectedMetadata(result1.DepartureAirports[1], 9, "comment6.1"); + AssertExpectedMetadata(result1.DepartureAirports[1], 9, "comment6.1"); // First - ACTIVE 1 Assert.Equal(2, result1.Active.Count); Assert.Equal("EGLL", result1.Active[0].Airfield); Assert.Equal("09R", result1.Active[0].Runway); - this.AssertExpectedMetadata(result1.Active[0], 10, "comment6.5"); + AssertExpectedMetadata(result1.Active[0], 10, "comment6.5"); // First - ACTIVE 2 Assert.Equal("EGLL", result1.Active[1].Airfield); Assert.Equal("09L", result1.Active[1].Runway); - this.AssertExpectedMetadata(result1.Active[1], 11, "comment6.5.1"); + AssertExpectedMetadata(result1.Active[1], 11, "comment6.5.1"); // First - GUEST Assert.Single(result1.Guests); Assert.Equal("GDR", result1.Guests[0].Controller); Assert.Equal("*", result1.Guests[0].DepartureAirport); Assert.Equal("EGAA", result1.Guests[0].ArrivalAirport); - this.AssertExpectedMetadata(result1.Guests[0], 12, "comment7"); + AssertExpectedMetadata(result1.Guests[0], 12, "comment7"); // Second - Sector result2 = this.sectorElementCollection.Sectors[1]; + Sector result2 = sectorElementCollection.Sectors[1]; Assert.Equal("TCNW", result2.Name); Assert.Equal(0, result2.MinimumAltitude); Assert.Equal(7000, result2.MaximumAltitude); - this.AssertExpectedMetadata(result2, 13, "comment8"); + AssertExpectedMetadata(result2, 13, "comment8"); // Second - OWNER Assert.Equal(3, result2.Owners.Owners.Count); Assert.Equal("TCNE", result2.Owners.Owners[0]); Assert.Equal("TCN", result2.Owners.Owners[1]); Assert.Equal("TC", result2.Owners.Owners[2]); - this.AssertExpectedMetadata(result2.Owners, 14, "comment9"); + AssertExpectedMetadata(result2.Owners, 14, "comment9"); // Second - ALTOWNER Assert.Single(result2.AltOwners); Assert.Equal("Observing London FIR", result2.AltOwners[0].Name); Assert.Single(result2.AltOwners[0].Owners); Assert.Equal("L", result2.AltOwners[0].Owners[0]); - this.AssertExpectedMetadata(result2.AltOwners[0], 15, "comment10"); + AssertExpectedMetadata(result2.AltOwners[0], 15, "comment10"); // Second - BORDER Assert.Single(result2.Borders); Assert.Single(result2.Borders[0].BorderLines); Assert.Equal("TCNE1", result2.Borders[0].BorderLines[0]); - this.AssertExpectedMetadata(result2.Borders[0], 16, "comment11"); + AssertExpectedMetadata(result2.Borders[0], 16, "comment11"); // Second - ARRAPT Assert.Single(result2.ArrivalAirports); Assert.Single(result2.ArrivalAirports[0].Airports); Assert.Equal("EGSS", result2.ArrivalAirports[0].Airports[0]); - this.AssertExpectedMetadata(result2.ArrivalAirports[0], 17, "comment12"); + AssertExpectedMetadata(result2.ArrivalAirports[0], 17, "comment12"); // Second - DEPAPT Assert.Single(result2.DepartureAirports); Assert.Single(result2.DepartureAirports[0].Airports); Assert.Equal("EGSS", result2.DepartureAirports[0].Airports[0]); - this.AssertExpectedMetadata(result2.DepartureAirports[0], 18, "comment13"); + AssertExpectedMetadata(result2.DepartureAirports[0], 18, "comment13"); // Second - ACTIVE Assert.Empty(result2.Active); @@ -382,24 +382,24 @@ public void TestItAddsData() Assert.Equal("SSR", result2.Guests[0].Controller); Assert.Equal("*", result2.Guests[0].DepartureAirport); Assert.Equal("*", result2.Guests[0].ArrivalAirport); - this.AssertExpectedMetadata(result2.Guests[0], 19, "comment14"); + AssertExpectedMetadata(result2.Guests[0], 19, "comment14"); Assert.Equal("SSR", result2.Guests[1].Controller); Assert.Equal("*", result2.Guests[1].DepartureAirport); Assert.Equal("EGSS", result2.Guests[1].ArrivalAirport); - this.AssertExpectedMetadata(result2.Guests[1], 20, "comment14.1"); + AssertExpectedMetadata(result2.Guests[1], 20, "comment14.1"); // Third - Sector result3 = this.sectorElementCollection.Sectors[2]; + Sector result3 = sectorElementCollection.Sectors[2]; Assert.Equal("Only AEAPP", result3.Name); Assert.Equal(0, result3.MinimumAltitude); Assert.Equal(0, result3.MaximumAltitude); - this.AssertExpectedMetadata(result3, 21, "comment15"); + AssertExpectedMetadata(result3, 21, "comment15"); // Third - OWNER Assert.Single(result3.Owners.Owners); Assert.Equal("AEA", result3.Owners.Owners[0]); - this.AssertExpectedMetadata(result3.Owners, 22, "comment16"); + AssertExpectedMetadata(result3.Owners, 22, "comment16"); // Third - The rest Assert.Empty(result3.AltOwners); diff --git a/tests/CompilerTest/Parser/SectorlineParserTest.cs b/tests/CompilerTest/Parser/SectorlineParserTest.cs index 76cdc01f..24990e3f 100644 --- a/tests/CompilerTest/Parser/SectorlineParserTest.cs +++ b/tests/CompilerTest/Parser/SectorlineParserTest.cs @@ -81,16 +81,16 @@ public class SectorlineParserTest: AbstractParserTestCase [MemberData(nameof(BadData))] public void ItRaisesSyntaxErrorsOnBadData(List lines) { - this.RunParserOnLines(lines); - Assert.Empty(this.sectorElementCollection.SectorLines); - Assert.Empty(this.sectorElementCollection.CircleSectorLines); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + RunParserOnLines(lines); + Assert.Empty(sectorElementCollection.SectorLines); + Assert.Empty(sectorElementCollection.CircleSectorLines); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItAddsCircleSectorlines() { - this.RunParserOnLines( + RunParserOnLines( new List(new[] { "CIRCLE_SECTORLINE:BBTWR:EGBB:2.5 ;comment", "DISPLAY:BBAPP:BBAPP:BBTWR ;comment1", @@ -101,41 +101,41 @@ public void TestItAddsCircleSectorlines() ); // First - CircleSectorline result1 = this.sectorElementCollection.CircleSectorLines[0]; + CircleSectorline result1 = sectorElementCollection.CircleSectorLines[0]; Assert.Equal("BBTWR", result1.Name); Assert.Equal("EGBB", result1.CentrePoint); Assert.Equal(2.5, result1.Radius); - this.AssertExpectedMetadata(result1); + AssertExpectedMetadata(result1); Assert.Equal(2, result1.DisplayRules.Count); Assert.Equal("BBAPP", result1.DisplayRules[0].ControlledSector); Assert.Equal("BBAPP", result1.DisplayRules[0].CompareSectorFirst); Assert.Equal("BBTWR", result1.DisplayRules[0].CompareSectorSecond); - this.AssertExpectedMetadata(result1.DisplayRules[0], 2, "comment1"); + AssertExpectedMetadata(result1.DisplayRules[0], 2, "comment1"); Assert.Equal("BBTWR", result1.DisplayRules[1].ControlledSector); Assert.Equal("BBAPP", result1.DisplayRules[1].CompareSectorFirst); Assert.Equal("BBTWR", result1.DisplayRules[1].CompareSectorSecond); - this.AssertExpectedMetadata(result1.DisplayRules[1], 3, "comment2"); + AssertExpectedMetadata(result1.DisplayRules[1], 3, "comment2"); // Second - CircleSectorline result2 = this.sectorElementCollection.CircleSectorLines[1]; + CircleSectorline result2 = sectorElementCollection.CircleSectorLines[1]; Assert.Equal("AEAPP", result2.Name); Assert.Equal(new Coordinate("N054.39.27.000", "W006.12.57.000"), result2.CentreCoordinate); Assert.Equal(30, result2.Radius); - this.AssertExpectedMetadata(result2, 4, "comment3"); + AssertExpectedMetadata(result2, 4, "comment3"); Assert.Single(result2.DisplayRules); Assert.Equal("AEAPP", result2.DisplayRules[0].ControlledSector); Assert.Equal("AEAPP", result2.DisplayRules[0].CompareSectorFirst); Assert.Equal("Rathlin West", result2.DisplayRules[0].CompareSectorSecond); - this.AssertExpectedMetadata(result2.DisplayRules[0], 5, "comment4"); + AssertExpectedMetadata(result2.DisplayRules[0], 5, "comment4"); } [Fact] public void TestItAddsSectorlines() { - this.RunParserOnLines( + RunParserOnLines( new List(new[] { "SECTORLINE:JJCTR - S6 ;comment1", "DISPLAY:London S6:JJCTR:London S6 ;comment2", @@ -151,58 +151,58 @@ public void TestItAddsSectorlines() ); // First - Sectorline result1 = this.sectorElementCollection.SectorLines[0]; + Sectorline result1 = sectorElementCollection.SectorLines[0]; Assert.Equal("JJCTR - S6", result1.Name); - this.AssertExpectedMetadata(result1, 1, "comment1"); + AssertExpectedMetadata(result1, 1, "comment1"); Assert.Equal(2, result1.DisplayRules.Count); Assert.Equal("London S6", result1.DisplayRules[0].ControlledSector); Assert.Equal("JJCTR", result1.DisplayRules[0].CompareSectorFirst); Assert.Equal("London S6", result1.DisplayRules[0].CompareSectorSecond); - this.AssertExpectedMetadata(result1.DisplayRules[0], 2, "comment2"); + AssertExpectedMetadata(result1.DisplayRules[0], 2, "comment2"); Assert.Equal("JJCTR", result1.DisplayRules[1].ControlledSector); Assert.Equal("JJCTR", result1.DisplayRules[1].CompareSectorFirst); Assert.Equal("London S6", result1.DisplayRules[1].CompareSectorSecond); - this.AssertExpectedMetadata(result1.DisplayRules[1], 3, "comment3"); + AssertExpectedMetadata(result1.DisplayRules[1], 3, "comment3"); Assert.Equal(2, result1.Coordinates.Count); Assert.Equal(new Coordinate("N050.00.00.000", "W002.40.34.000"), result1.Coordinates[0].Coordinate); - this.AssertExpectedMetadata(result1.Coordinates[0], 4, "comment4"); + AssertExpectedMetadata(result1.Coordinates[0], 4, "comment4"); Assert.Equal(new Coordinate("N049.59.59.000", "W002.29.35.000"), result1.Coordinates[1].Coordinate); - this.AssertExpectedMetadata(result1.Coordinates[1], 5, "comment5"); + AssertExpectedMetadata(result1.Coordinates[1], 5, "comment5"); // Second - Sectorline result2 = this.sectorElementCollection.SectorLines[1]; + Sectorline result2 = sectorElementCollection.SectorLines[1]; Assert.Equal("JJCTR - LS", result2.Name); - this.AssertExpectedMetadata(result2, 6, "comment6"); + AssertExpectedMetadata(result2, 6, "comment6"); Assert.Equal(2, result2.DisplayRules.Count); Assert.Equal("London AC Worthing", result2.DisplayRules[0].ControlledSector); Assert.Equal("JJCTR", result2.DisplayRules[0].CompareSectorFirst); Assert.Equal("London AC Worthing", result2.DisplayRules[0].CompareSectorSecond); - this.AssertExpectedMetadata(result2.DisplayRules[0], 7, "comment7"); + AssertExpectedMetadata(result2.DisplayRules[0], 7, "comment7"); Assert.Equal("JJCTR", result2.DisplayRules[1].ControlledSector); Assert.Equal("JJCTR", result2.DisplayRules[1].CompareSectorFirst); Assert.Equal("London AC Worthing", result2.DisplayRules[1].CompareSectorSecond); - this.AssertExpectedMetadata(result2.DisplayRules[1], 8, "comment8"); + AssertExpectedMetadata(result2.DisplayRules[1], 8, "comment8"); Assert.Equal(2, result2.Coordinates.Count); Assert.Equal(new Coordinate("N049.59.59.000", "W002.29.35.000"), result2.Coordinates[0].Coordinate); - this.AssertExpectedMetadata(result2.Coordinates[0], 9, "comment9"); + AssertExpectedMetadata(result2.Coordinates[0], 9, "comment9"); Assert.Equal(new Coordinate("N050.00.00.000", "W001.47.00.000"), result2.Coordinates[1].Coordinate); - this.AssertExpectedMetadata(result2.Coordinates[1], 10, "comment10"); + AssertExpectedMetadata(result2.Coordinates[1], 10, "comment10"); } [Fact] public void TestItAddsMixedData() { - this.RunParserOnLines( + RunParserOnLines( new List(new[] { "SECTORLINE:JJCTR - LS ;comment6", "DISPLAY:London AC Worthing:JJCTR:JJCTR ;comment7", @@ -217,54 +217,54 @@ public void TestItAddsMixedData() ); // First - CircleSectorline result1 = this.sectorElementCollection.CircleSectorLines[0]; + CircleSectorline result1 = sectorElementCollection.CircleSectorLines[0]; Assert.Equal("BBTWR", result1.Name); Assert.Equal("EGBB", result1.CentrePoint); Assert.Equal(2.5, result1.Radius); - this.AssertExpectedMetadata(result1, 7); + AssertExpectedMetadata(result1, 7); Assert.Equal(2, result1.DisplayRules.Count); Assert.Equal("BBAPP", result1.DisplayRules[0].ControlledSector); Assert.Equal("BBAPP", result1.DisplayRules[0].CompareSectorFirst); Assert.Equal("BBTWR", result1.DisplayRules[0].CompareSectorSecond); - this.AssertExpectedMetadata(result1.DisplayRules[0], 8, "comment1"); + AssertExpectedMetadata(result1.DisplayRules[0], 8, "comment1"); Assert.Equal("BBTWR", result1.DisplayRules[1].ControlledSector); Assert.Equal("BBAPP", result1.DisplayRules[1].CompareSectorFirst); Assert.Equal("BBTWR", result1.DisplayRules[1].CompareSectorSecond); - this.AssertExpectedMetadata(result1.DisplayRules[1], 9, "comment2"); + AssertExpectedMetadata(result1.DisplayRules[1], 9, "comment2"); // Second - Sectorline result2 = this.sectorElementCollection.SectorLines[0]; + Sectorline result2 = sectorElementCollection.SectorLines[0]; Assert.Equal("JJCTR - LS", result2.Name); - this.AssertExpectedMetadata(result2, 1, "comment6"); + AssertExpectedMetadata(result2, 1, "comment6"); Assert.Equal(2, result2.DisplayRules.Count); Assert.Equal("London AC Worthing", result2.DisplayRules[0].ControlledSector); Assert.Equal("JJCTR", result2.DisplayRules[0].CompareSectorFirst); Assert.Equal("JJCTR", result2.DisplayRules[0].CompareSectorSecond); - this.AssertExpectedMetadata(result2.DisplayRules[0], 2, "comment7"); + AssertExpectedMetadata(result2.DisplayRules[0], 2, "comment7"); Assert.Equal("JJCTR", result2.DisplayRules[1].ControlledSector); Assert.Equal("JJCTR", result2.DisplayRules[1].CompareSectorFirst); Assert.Equal("London AC Worthing", result2.DisplayRules[1].CompareSectorSecond); - this.AssertExpectedMetadata(result2.DisplayRules[1], 3, "comment8"); + AssertExpectedMetadata(result2.DisplayRules[1], 3, "comment8"); Assert.Equal(2, result2.Coordinates.Count); Assert.Equal(new Coordinate("N049.59.59.000", "W002.29.35.000"), result2.Coordinates[0].Coordinate); - this.AssertExpectedMetadata(result2.Coordinates[0], 4, "comment9"); + AssertExpectedMetadata(result2.Coordinates[0], 4, "comment9"); Assert.Equal(new Coordinate("N050.00.00.000", "W001.47.00.000"), result2.Coordinates[1].Coordinate); - this.AssertExpectedMetadata(result2.Coordinates[1], 5, "comment10"); + AssertExpectedMetadata(result2.Coordinates[1], 5, "comment10"); } [Fact] public void TestItAddsMixedDataNoDisplayRules() { - this.RunParserOnLines( + RunParserOnLines( new List(new[] { "SECTORLINE:JJCTR - LS ;comment6", "COORD:N049.59.59.000:W002.29.35.000 ;comment9", @@ -275,7 +275,7 @@ public void TestItAddsMixedDataNoDisplayRules() ); // First - CircleSectorline result1 = this.sectorElementCollection.CircleSectorLines[0]; + CircleSectorline result1 = sectorElementCollection.CircleSectorLines[0]; Assert.Equal("BBTWR", result1.Name); Assert.Equal("EGBB", result1.CentrePoint); Assert.Equal(2.5, result1.Radius); @@ -283,7 +283,7 @@ public void TestItAddsMixedDataNoDisplayRules() // Second - Sectorline result2 = this.sectorElementCollection.SectorLines[0]; + Sectorline result2 = sectorElementCollection.SectorLines[0]; Assert.Equal("JJCTR - LS", result2.Name); Assert.Empty(result2.DisplayRules); } diff --git a/tests/CompilerTest/Parser/SidStarRouteParserTest.cs b/tests/CompilerTest/Parser/SidStarRouteParserTest.cs index 744aff22..69274908 100644 --- a/tests/CompilerTest/Parser/SidStarRouteParserTest.cs +++ b/tests/CompilerTest/Parser/SidStarRouteParserTest.cs @@ -35,19 +35,19 @@ public class SidStarRouteParserTest: AbstractParserTestCase [MemberData(nameof(BadData))] public void ItRaisesSyntaxErrorsOnBadData(List lines) { - this.RunParserOnLines(lines); + RunParserOnLines(lines); - Assert.Empty(this.sectorElementCollection.StarRoutes); - Assert.Empty(this.sectorElementCollection.SidRoutes); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Empty(sectorElementCollection.StarRoutes); + Assert.Empty(sectorElementCollection.SidRoutes); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItAddsSingleRowElements() { - this.RunParserOnLines(new List(new[] { "Test abc abc def def ;comment" })); + RunParserOnLines(new List(new[] { "Test abc abc def def ;comment" })); - SidStarRoute result = this.sectorElementCollection.SidRoutes[0]; + SidStarRoute result = sectorElementCollection.SidRoutes[0]; Assert.Equal("Test", result.Identifier); Assert.Equal( new RouteSegment( @@ -62,14 +62,14 @@ public void TestItAddsSingleRowElements() ); Assert.Empty(result.Segments); - this.AssertExpectedMetadata(result); - this.AssertExpectedMetadata(result.InitialSegment); + AssertExpectedMetadata(result); + AssertExpectedMetadata(result.InitialSegment); } [Fact] public void TestItAddsMultiRowElements() { - this.RunParserOnLines(new List( + RunParserOnLines(new List( new[] { "Test abc abc def def ;comment", " def def ghi ghi ;comment" @@ -89,7 +89,7 @@ public void TestItAddsMultiRowElements() ), }; - SidStarRoute result = this.sectorElementCollection.SidRoutes[0]; + SidStarRoute result = sectorElementCollection.SidRoutes[0]; Assert.Equal("Test", result.Identifier); Assert.Equal( new RouteSegment( @@ -104,15 +104,15 @@ public void TestItAddsMultiRowElements() ); Assert.Equal(expectedAdditionalSegments, result.Segments); - this.AssertExpectedMetadata(result); - this.AssertExpectedMetadata(result.InitialSegment); - this.AssertExpectedMetadata(result.Segments[0], 2); + AssertExpectedMetadata(result); + AssertExpectedMetadata(result.InitialSegment); + AssertExpectedMetadata(result.Segments[0], 2); } [Fact] public void TestItAddsMultipleElements() { - this.RunParserOnLines(new List( + RunParserOnLines(new List( new List( new[] { "Test abc abc def def;comment", @@ -134,7 +134,7 @@ public void TestItAddsMultipleElements() ) }; - SidStarRoute result = this.sectorElementCollection.SidRoutes[0]; + SidStarRoute result = sectorElementCollection.SidRoutes[0]; Assert.Equal("Test", result.Identifier); Assert.Equal( new RouteSegment( @@ -148,11 +148,11 @@ public void TestItAddsMultipleElements() result.InitialSegment ); Assert.Equal(expectedAdditionalSegments1, result.Segments); - this.AssertExpectedMetadata(result); - this.AssertExpectedMetadata(result.InitialSegment); - this.AssertExpectedMetadata(result.Segments[0], 2); + AssertExpectedMetadata(result); + AssertExpectedMetadata(result.InitialSegment); + AssertExpectedMetadata(result.Segments[0], 2); - SidStarRoute result2 = this.sectorElementCollection.SidRoutes[1]; + SidStarRoute result2 = sectorElementCollection.SidRoutes[1]; Assert.Equal("Test 2", result2.Identifier); Assert.Equal( new RouteSegment( @@ -166,14 +166,14 @@ public void TestItAddsMultipleElements() result2.InitialSegment ); Assert.Empty(result2.Segments); - this.AssertExpectedMetadata(result2, 3); - this.AssertExpectedMetadata(result2.InitialSegment, 3); + AssertExpectedMetadata(result2, 3); + AssertExpectedMetadata(result2.InitialSegment, 3); } [Fact] public void TestItAddsMultipleElementsWithColour() { - this.RunParserOnLines(new List( + RunParserOnLines(new List( new[] { "Test abc abc def def Red", " def def ghi ghi Yellow ;comment", @@ -195,7 +195,7 @@ public void TestItAddsMultipleElementsWithColour() }; - SidStarRoute result = this.sectorElementCollection.SidRoutes[0]; + SidStarRoute result = sectorElementCollection.SidRoutes[0]; Assert.Equal("Test", result.Identifier); Assert.Equal( new RouteSegment( @@ -210,11 +210,11 @@ public void TestItAddsMultipleElementsWithColour() result.InitialSegment ); Assert.Equal(expectedAdditionalSegments1, result.Segments); - this.AssertExpectedMetadata(result, commentString: ""); - this.AssertExpectedMetadata(result.InitialSegment, commentString: ""); - this.AssertExpectedMetadata(result.Segments[0], 2); + AssertExpectedMetadata(result, commentString: ""); + AssertExpectedMetadata(result.InitialSegment, commentString: ""); + AssertExpectedMetadata(result.Segments[0], 2); - SidStarRoute result2 = this.sectorElementCollection.SidRoutes[1]; + SidStarRoute result2 = sectorElementCollection.SidRoutes[1]; Assert.Equal("Test 2", result2.Identifier); Assert.Equal( new RouteSegment( @@ -229,8 +229,8 @@ public void TestItAddsMultipleElementsWithColour() result2.InitialSegment ); Assert.Empty(result2.Segments); - this.AssertExpectedMetadata(result2, 3); - this.AssertExpectedMetadata(result2.InitialSegment, 3); + AssertExpectedMetadata(result2, 3); + AssertExpectedMetadata(result2.InitialSegment, 3); } protected override InputDataType GetInputDataType() diff --git a/tests/CompilerTest/Parser/VatsimRtfFrequencyParserTest.cs b/tests/CompilerTest/Parser/VatsimRtfFrequencyParserTest.cs index 52e54e2c..be6378d0 100644 --- a/tests/CompilerTest/Parser/VatsimRtfFrequencyParserTest.cs +++ b/tests/CompilerTest/Parser/VatsimRtfFrequencyParserTest.cs @@ -9,7 +9,7 @@ public class VatsimRtfFrequencyParserTest public VatsimRtfFrequencyParserTest() { - this.parser = new VatsimRtfFrequencyParser(); + parser = new VatsimRtfFrequencyParser(); } [Theory] @@ -27,7 +27,7 @@ public VatsimRtfFrequencyParserTest() [InlineData("119.720", "119.720")] // Everything ok - round up public void TestItParsesFrequencies(string frequency, string expected) { - Assert.Equal(expected, this.parser.ParseFrequency(frequency)); + Assert.Equal(expected, parser.ParseFrequency(frequency)); } } } diff --git a/tests/CompilerTest/Parser/VorParserTest.cs b/tests/CompilerTest/Parser/VorParserTest.cs index 8e1e30af..1d97b418 100644 --- a/tests/CompilerTest/Parser/VorParserTest.cs +++ b/tests/CompilerTest/Parser/VorParserTest.cs @@ -38,34 +38,34 @@ public class VorParserTest: AbstractParserTestCase [MemberData(nameof(BadData))] public void ItRaisesSyntaxErrorsOnBadData(List lines) { - this.RunParserOnLines(lines); + RunParserOnLines(lines); - Assert.Empty(this.sectorElementCollection.Vors); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Empty(sectorElementCollection.Vors); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItAddsVorData() { - this.RunParserOnLines(new List(new[] { "BHD 112.050 N050.57.00.000 W001.21.24.490;comment" })); + RunParserOnLines(new List(new[] { "BHD 112.050 N050.57.00.000 W001.21.24.490;comment" })); - Vor result = this.sectorElementCollection.Vors[0]; + Vor result = sectorElementCollection.Vors[0]; Assert.Equal("BHD", result.Identifier); Assert.Equal("112.050", result.Frequency); Assert.Equal(new Coordinate("N050.57.00.000", "W001.21.24.490"), result.Coordinate); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); } [Fact] public void TestItAddsVorDataTwoLetterIdentifier() { - this.RunParserOnLines(new List(new[] { "BH 112.050 N050.57.00.000 W001.21.24.490;comment" })); + RunParserOnLines(new List(new[] { "BH 112.050 N050.57.00.000 W001.21.24.490;comment" })); - Vor result = this.sectorElementCollection.Vors[0]; + Vor result = sectorElementCollection.Vors[0]; Assert.Equal("BH", result.Identifier); Assert.Equal("112.050", result.Frequency); Assert.Equal(new Coordinate("N050.57.00.000", "W001.21.24.490"), result.Coordinate); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); } protected override InputDataType GetInputDataType() diff --git a/tests/CompilerTest/Parser/VrpParserTest.cs b/tests/CompilerTest/Parser/VrpParserTest.cs index ea948be0..286a1ed5 100644 --- a/tests/CompilerTest/Parser/VrpParserTest.cs +++ b/tests/CompilerTest/Parser/VrpParserTest.cs @@ -11,37 +11,37 @@ public class VrpParserTest: AbstractParserTestCase { public VrpParserTest() { - this.SetInputFileName("EGLL/VRPs.txt"); + SetInputFileName("EGLL/VRPs.txt"); } [Fact] public void TestItRaisesASyntaxErrorIfIncorrectNumberOfSegments() { - this.RunParserOnLines(new List(new[] { "abc:def" })); + RunParserOnLines(new List(new[] { "abc:def" })); - Assert.Empty(this.sectorElementCollection.Fixes); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Empty(sectorElementCollection.Fixes); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItRaisesAnErrorIfInvalidCoordinate() { - this.RunParserOnLines(new List(new[] { "Text:abc:def" })); + RunParserOnLines(new List(new[] { "Text:abc:def" })); - Assert.Empty(this.sectorElementCollection.Fixes); - this.logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + Assert.Empty(sectorElementCollection.Fixes); + logger.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItAddsVrpData() { - this.RunParserOnLines(new List(new[] { "Text:N054.28.46.319:W006.15.33.933 ;comment" })); + RunParserOnLines(new List(new[] { "Text:N054.28.46.319:W006.15.33.933 ;comment" })); - Freetext result = this.sectorElementCollection.Freetext[0]; + Freetext result = sectorElementCollection.Freetext[0]; Assert.Equal(new Coordinate("N054.28.46.319", "W006.15.33.933"), result.Coordinate); Assert.Equal("EGLL VRPs", result.Title); Assert.Equal("Text", result.Text); - this.AssertExpectedMetadata(result); + AssertExpectedMetadata(result); } protected override InputDataType GetInputDataType() diff --git a/tests/CompilerTest/Validate/AbstractValidatorTestCase.cs b/tests/CompilerTest/Validate/AbstractValidatorTestCase.cs index 7da40bac..a7a9d619 100644 --- a/tests/CompilerTest/Validate/AbstractValidatorTestCase.cs +++ b/tests/CompilerTest/Validate/AbstractValidatorTestCase.cs @@ -17,13 +17,13 @@ public abstract class AbstractValidatorTestCase protected void AssertNoValidationErrors() { - this.AssertValidationErrors(0); + AssertValidationErrors(0); } protected void AssertValidationErrors(int count = 1) { - this.GetValidationRule().Validate(sectorElements, args, loggerMock.Object); - this.loggerMock.Verify(foo => foo.AddEvent(It.IsAny()), Times.Exactly(count)); + GetValidationRule().Validate(sectorElements, args, loggerMock.Object); + loggerMock.Verify(foo => foo.AddEvent(It.IsAny()), Times.Exactly(count)); } protected abstract IValidationRule GetValidationRule(); diff --git a/tests/CompilerTest/Validate/AllAirportsMustHaveUniqueCodeTest.cs b/tests/CompilerTest/Validate/AllAirportsMustHaveUniqueCodeTest.cs index 2170c581..720b5d54 100644 --- a/tests/CompilerTest/Validate/AllAirportsMustHaveUniqueCodeTest.cs +++ b/tests/CompilerTest/Validate/AllAirportsMustHaveUniqueCodeTest.cs @@ -13,28 +13,28 @@ public class AllAirportsMustHaveUniqueCodeTest: AbstractValidatorTestCase public AllAirportsMustHaveUniqueCodeTest() { - this.airfield1 = AirportFactory.Make("EGKK"); - this.airfield2 = AirportFactory.Make("EGLL"); - this.airfield3 = AirportFactory.Make("EGKK"); + airfield1 = AirportFactory.Make("EGKK"); + airfield2 = AirportFactory.Make("EGLL"); + airfield3 = AirportFactory.Make("EGKK"); } [Fact] public void TestItPassesOnNoDuplicates() { - this.sectorElements.Add(airfield1); - this.sectorElements.Add(airfield2); + sectorElements.Add(airfield1); + sectorElements.Add(airfield2); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnDuplicates() { - this.sectorElements.Add(airfield1); - this.sectorElements.Add(airfield2); - this.sectorElements.Add(airfield3); + sectorElements.Add(airfield1); + sectorElements.Add(airfield2); + sectorElements.Add(airfield3); - this.AssertValidationErrors(); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllAirwaysMustHaveValidPointsTest.cs b/tests/CompilerTest/Validate/AllAirwaysMustHaveValidPointsTest.cs index 30702a12..58b89e58 100644 --- a/tests/CompilerTest/Validate/AllAirwaysMustHaveValidPointsTest.cs +++ b/tests/CompilerTest/Validate/AllAirwaysMustHaveValidPointsTest.cs @@ -10,10 +10,10 @@ public class AllAirwaysMustHaveValidPointsTest: AbstractValidatorTestCase public AllAirwaysMustHaveValidPointsTest() { - this.sectorElements.Add(FixFactory.Make("testfix")); - this.sectorElements.Add(VorFactory.Make("testvor")); - this.sectorElements.Add(NdbFactory.Make("testndb")); - this.sectorElements.Add(AirportFactory.Make("testairport")); + sectorElements.Add(FixFactory.Make("testfix")); + sectorElements.Add(VorFactory.Make("testvor")); + sectorElements.Add(NdbFactory.Make("testndb")); + sectorElements.Add(AirportFactory.Make("testairport")); } private static AirwaySegment GetAirway(AirwayType type, string startPointIdentifier, string endPointIdentifier) @@ -32,43 +32,43 @@ private static AirwaySegment GetAirway(AirwayType type, string startPointIdentif [Fact] public void TestItPassesOnValidPointLow() { - this.sectorElements.Add(GetAirway(AirwayType.LOW, "testfix", "testvor")); - this.AssertNoValidationErrors(); + sectorElements.Add(GetAirway(AirwayType.LOW, "testfix", "testvor")); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnInvalidStartPointLow() { - this.sectorElements.Add(GetAirway(AirwayType.LOW, "nottestfix", "testvor")); - this.AssertValidationErrors(); + sectorElements.Add(GetAirway(AirwayType.LOW, "nottestfix", "testvor")); + AssertValidationErrors(); } [Fact] public void TestItFailsOnInvalidEndPointLow() { - this.sectorElements.Add(GetAirway(AirwayType.LOW, "testfix", "nottestvor")); - this.AssertValidationErrors(); + sectorElements.Add(GetAirway(AirwayType.LOW, "testfix", "nottestvor")); + AssertValidationErrors(); } [Fact] public void TestItPassesOnValidPointHigh() { - this.sectorElements.Add(GetAirway(AirwayType.HIGH, "testfix", "testvor")); - this.AssertNoValidationErrors(); + sectorElements.Add(GetAirway(AirwayType.HIGH, "testfix", "testvor")); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnInvalidStartPointHigh() { - this.sectorElements.Add(GetAirway(AirwayType.HIGH, "nottestfix", "testvor")); - this.AssertValidationErrors(); + sectorElements.Add(GetAirway(AirwayType.HIGH, "nottestfix", "testvor")); + AssertValidationErrors(); } [Fact] public void TestItFailsOnInvalidEndPointHigh() { - this.sectorElements.Add(GetAirway(AirwayType.HIGH, "testfix", "nottestvor")); - this.AssertValidationErrors(); + sectorElements.Add(GetAirway(AirwayType.HIGH, "testfix", "nottestvor")); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllArtccsMustHaveValidPointsTest.cs b/tests/CompilerTest/Validate/AllArtccsMustHaveValidPointsTest.cs index c42731d7..4f9cf8d0 100644 --- a/tests/CompilerTest/Validate/AllArtccsMustHaveValidPointsTest.cs +++ b/tests/CompilerTest/Validate/AllArtccsMustHaveValidPointsTest.cs @@ -9,10 +9,10 @@ public class AllArtccsMustHaveValidPointsTest: AbstractValidatorTestCase { public AllArtccsMustHaveValidPointsTest() { - this.sectorElements.Add(FixFactory.Make("testfix")); - this.sectorElements.Add(VorFactory.Make("testvor")); - this.sectorElements.Add(NdbFactory.Make("testndb")); - this.sectorElements.Add(AirportFactory.Make("testairport")); + sectorElements.Add(FixFactory.Make("testfix")); + sectorElements.Add(VorFactory.Make("testvor")); + sectorElements.Add(NdbFactory.Make("testndb")); + sectorElements.Add(AirportFactory.Make("testairport")); } private static ArtccSegment GetArtcc(ArtccType type, string startPointIdentifier, string endPointIdentifier) @@ -31,64 +31,64 @@ private static ArtccSegment GetArtcc(ArtccType type, string startPointIdentifier [Fact] public void TestItPassesOnValidPointRegular() { - this.sectorElements.Add(GetArtcc(ArtccType.REGULAR, "testfix", "testvor")); - this.AssertNoValidationErrors(); + sectorElements.Add(GetArtcc(ArtccType.REGULAR, "testfix", "testvor")); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnInvalidStartPointRegular() { - this.sectorElements.Add(GetArtcc(ArtccType.REGULAR, "nottestfix", "testvor")); - this.AssertValidationErrors(); + sectorElements.Add(GetArtcc(ArtccType.REGULAR, "nottestfix", "testvor")); + AssertValidationErrors(); } [Fact] public void TestItFailsOnInvalidEndPointRegular() { - this.sectorElements.Add(GetArtcc(ArtccType.REGULAR, "testfix", "nottestvor")); - this.AssertValidationErrors(); + sectorElements.Add(GetArtcc(ArtccType.REGULAR, "testfix", "nottestvor")); + AssertValidationErrors(); } [Fact] public void TestItPassesOnValidPointLow() { - this.sectorElements.Add(GetArtcc(ArtccType.LOW, "testfix", "testvor")); - this.AssertNoValidationErrors(); + sectorElements.Add(GetArtcc(ArtccType.LOW, "testfix", "testvor")); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnInvalidStartPointLow() { - this.sectorElements.Add(GetArtcc(ArtccType.LOW, "nottestfix", "testvor")); - this.AssertValidationErrors(); + sectorElements.Add(GetArtcc(ArtccType.LOW, "nottestfix", "testvor")); + AssertValidationErrors(); } [Fact] public void TestItFailsOnInvalidEndPointLow() { - this.sectorElements.Add(GetArtcc(ArtccType.LOW, "testfix", "nottestvor")); - this.AssertValidationErrors(); + sectorElements.Add(GetArtcc(ArtccType.LOW, "testfix", "nottestvor")); + AssertValidationErrors(); } [Fact] public void TestItPassesOnValidPointHigh() { - this.sectorElements.Add(GetArtcc(ArtccType.HIGH, "testfix", "testvor")); - this.AssertNoValidationErrors(); + sectorElements.Add(GetArtcc(ArtccType.HIGH, "testfix", "testvor")); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnInvalidStartPointHigh() { - this.sectorElements.Add(GetArtcc(ArtccType.HIGH, "nottestfix", "testvor")); - this.AssertValidationErrors(); + sectorElements.Add(GetArtcc(ArtccType.HIGH, "nottestfix", "testvor")); + AssertValidationErrors(); } [Fact] public void TestItFailsOnInvalidEndPointHigh() { - this.sectorElements.Add(GetArtcc(ArtccType.HIGH, "testfix", "nottestvor")); - this.AssertValidationErrors(); + sectorElements.Add(GetArtcc(ArtccType.HIGH, "testfix", "nottestvor")); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllCircleSectorlinesMustHaveValidCentreTest.cs b/tests/CompilerTest/Validate/AllCircleSectorlinesMustHaveValidCentreTest.cs index c51fe98e..0f0d1835 100644 --- a/tests/CompilerTest/Validate/AllCircleSectorlinesMustHaveValidCentreTest.cs +++ b/tests/CompilerTest/Validate/AllCircleSectorlinesMustHaveValidCentreTest.cs @@ -9,10 +9,10 @@ public class AllCircleSectorlinesMustHaveValidCentreTest: AbstractValidatorTestC { public AllCircleSectorlinesMustHaveValidCentreTest() { - this.sectorElements.Add(FixFactory.Make("testfix")); - this.sectorElements.Add(VorFactory.Make("testvor")); - this.sectorElements.Add(NdbFactory.Make("testndb")); - this.sectorElements.Add(AirportFactory.Make("testairport")); + sectorElements.Add(FixFactory.Make("testfix")); + sectorElements.Add(VorFactory.Make("testvor")); + sectorElements.Add(NdbFactory.Make("testndb")); + sectorElements.Add(AirportFactory.Make("testairport")); } [Theory] @@ -22,11 +22,11 @@ public AllCircleSectorlinesMustHaveValidCentreTest() [InlineData("testairport")] public void TestItPassesOnValidFix(string fix) { - this.sectorElements.Add(CircleSectorlineFactory.Make(centre: fix)); - this.sectorElements.Add(CircleSectorlineFactory.Make(centre: fix)); + sectorElements.Add(CircleSectorlineFactory.Make(centre: fix)); + sectorElements.Add(CircleSectorlineFactory.Make(centre: fix)); // This one is ignored by the rule - this.sectorElements.Add( + sectorElements.Add( new CircleSectorline( "ONE", new Coordinate("abc", "def"), @@ -38,7 +38,7 @@ public void TestItPassesOnValidFix(string fix) ) ); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Theory] @@ -48,11 +48,11 @@ public void TestItPassesOnValidFix(string fix) [InlineData("testairport", "nottestairport")] public void TestItFailsOnInvalidFix(string firstFix, string secondFix) { - this.sectorElements.Add(CircleSectorlineFactory.Make(centre: firstFix)); - this.sectorElements.Add(CircleSectorlineFactory.Make(centre: secondFix)); + sectorElements.Add(CircleSectorlineFactory.Make(centre: firstFix)); + sectorElements.Add(CircleSectorlineFactory.Make(centre: secondFix)); // This one is ignored by the rule - this.sectorElements.Add( + sectorElements.Add( new CircleSectorline( "ONE", new Coordinate("abc", "def"), @@ -64,7 +64,7 @@ public void TestItFailsOnInvalidFix(string firstFix, string secondFix) ) ); - this.AssertValidationErrors(); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllCircleSectorlinesMustHaveValidDisplaySectorsTest.cs b/tests/CompilerTest/Validate/AllCircleSectorlinesMustHaveValidDisplaySectorsTest.cs index 6b6d267f..8a10a769 100644 --- a/tests/CompilerTest/Validate/AllCircleSectorlinesMustHaveValidDisplaySectorsTest.cs +++ b/tests/CompilerTest/Validate/AllCircleSectorlinesMustHaveValidDisplaySectorsTest.cs @@ -10,8 +10,8 @@ public class AllCircleSectorlinesMustHaveValidDisplaySectorsTest: AbstractValida { public AllCircleSectorlinesMustHaveValidDisplaySectorsTest() { - this.sectorElements.Add(SectorFactory.Make("COOL1")); - this.sectorElements.Add(SectorFactory.Make("COOL2")); + sectorElements.Add(SectorFactory.Make("COOL1")); + sectorElements.Add(SectorFactory.Make("COOL2")); } [Theory] @@ -20,7 +20,7 @@ public AllCircleSectorlinesMustHaveValidDisplaySectorsTest() [InlineData("COOL1", "COOL1", "COOL2", "COOL2", "COOL2", "COOL1")] public void TestItPassesOnValidSector(string oneA, string twoA, string threeA, string oneB, string twoB, string threeB) { - this.sectorElements.Add( + sectorElements.Add( CircleSectorlineFactory.Make( displayRules: new List { SectorLineDisplayRuleFactory.Make(oneA, twoA, threeA), @@ -28,7 +28,7 @@ public void TestItPassesOnValidSector(string oneA, string twoA, string threeA, s } ) ); - this.sectorElements.Add( + sectorElements.Add( CircleSectorlineFactory.Make( displayRules: new List { SectorLineDisplayRuleFactory.Make(oneA, twoA, threeA), @@ -37,7 +37,7 @@ public void TestItPassesOnValidSector(string oneA, string twoA, string threeA, s ) ); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Theory] @@ -49,14 +49,14 @@ public void TestItPassesOnValidSector(string oneA, string twoA, string threeA, s [InlineData("COOL1", "COOL1", "COOL2", "COOL2", "COOL2", "NOTCOOL1")] public void TestItFailsOnInvalidSector(string oneA, string twoA, string threeA, string oneB, string twoB, string threeB) { - this.sectorElements.Add( + sectorElements.Add( CircleSectorlineFactory.Make( displayRules: new List { SectorLineDisplayRuleFactory.Make(oneA, twoA, threeA), } ) ); - this.sectorElements.Add( + sectorElements.Add( CircleSectorlineFactory.Make( displayRules: new List { SectorLineDisplayRuleFactory.Make(oneB, twoB, threeB), @@ -64,7 +64,7 @@ public void TestItFailsOnInvalidSector(string oneA, string twoA, string threeA, ) ); - this.AssertValidationErrors(); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllColoursMustBeValidTest.cs b/tests/CompilerTest/Validate/AllColoursMustBeValidTest.cs index c2f4e700..6f38e5c7 100644 --- a/tests/CompilerTest/Validate/AllColoursMustBeValidTest.cs +++ b/tests/CompilerTest/Validate/AllColoursMustBeValidTest.cs @@ -15,34 +15,34 @@ public class AllColoursMustBeValidTest: AbstractValidatorTestCase public AllColoursMustBeValidTest() { - this.first = ColourFactory.Make("colour1", -1); - this.second = ColourFactory.Make("colour2", 0); - this.third = ColourFactory.Make("colour3", 255); - this.fourth = ColourFactory.Make("colour4", 16777215); - this.fifth = ColourFactory.Make("colour5", 16777216); + first = ColourFactory.Make("colour1", -1); + second = ColourFactory.Make("colour2", 0); + third = ColourFactory.Make("colour3", 255); + fourth = ColourFactory.Make("colour4", 16777215); + fifth = ColourFactory.Make("colour5", 16777216); } [Fact] public void TestItPassesOnValidColours() { - this.sectorElements.Add(this.second); - this.sectorElements.Add(this.third); - this.sectorElements.Add(this.fourth); - this.AssertNoValidationErrors(); + sectorElements.Add(second); + sectorElements.Add(third); + sectorElements.Add(fourth); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnNegativeValues() { - this.sectorElements.Add(this.first); - this.AssertValidationErrors(); + sectorElements.Add(first); + AssertValidationErrors(); } [Fact] public void TestItFailsOnValuesOverMaximum() { - this.sectorElements.Add(this.fifth); - this.AssertValidationErrors(); + sectorElements.Add(fifth); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllColoursMustHaveAUniqueIdTest.cs b/tests/CompilerTest/Validate/AllColoursMustHaveAUniqueIdTest.cs index af4bd28f..a4c4fcba 100644 --- a/tests/CompilerTest/Validate/AllColoursMustHaveAUniqueIdTest.cs +++ b/tests/CompilerTest/Validate/AllColoursMustHaveAUniqueIdTest.cs @@ -13,26 +13,26 @@ public class AllColoursMustHaveAUniqueIdTest: AbstractValidatorTestCase public AllColoursMustHaveAUniqueIdTest() { - this.first = ColourFactory.Make("colour1"); - this.second = ColourFactory.Make("colour2"); - this.third = ColourFactory.Make("colour1"); + first = ColourFactory.Make("colour1"); + second = ColourFactory.Make("colour2"); + third = ColourFactory.Make("colour1"); } [Fact] public void TestItPassesIfNoDuplicates() { - this.sectorElements.Add(this.first); - this.sectorElements.Add(this.second); - this.AssertNoValidationErrors(); + sectorElements.Add(first); + sectorElements.Add(second); + AssertNoValidationErrors(); } [Fact] public void TestItFailsIfThereAreDuplicates() { - this.sectorElements.Add(this.first); - this.sectorElements.Add(this.second); - this.sectorElements.Add(this.third); - this.AssertValidationErrors(); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidArrivalRunwaysTest.cs b/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidArrivalRunwaysTest.cs index 1d1e9359..b57d1dcd 100644 --- a/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidArrivalRunwaysTest.cs +++ b/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidArrivalRunwaysTest.cs @@ -8,12 +8,12 @@ public class AllCoordinationPointsMustHaveValidArrivalRunwaysTest: AbstractValid { public AllCoordinationPointsMustHaveValidArrivalRunwaysTest() { - this.sectorElements.Add(AirportFactory.Make("EGKK")); - this.sectorElements.Add(RunwayFactory.Make("EGKK", "26L", "09")); - this.sectorElements.Add(AirportFactory.Make("EGLL")); - this.sectorElements.Add(RunwayFactory.Make("EGLL", "09R", "09")); - this.sectorElements.Add(RunwayFactory.Make("EGLL", "09L", "09")); - this.sectorElements.Add(AirportFactory.Make("EGSS")); + sectorElements.Add(AirportFactory.Make("EGKK")); + sectorElements.Add(RunwayFactory.Make("EGKK", "26L", "09")); + sectorElements.Add(AirportFactory.Make("EGLL")); + sectorElements.Add(RunwayFactory.Make("EGLL", "09R", "09")); + sectorElements.Add(RunwayFactory.Make("EGLL", "09L", "09")); + sectorElements.Add(AirportFactory.Make("EGSS")); } [Theory] @@ -28,9 +28,9 @@ public AllCoordinationPointsMustHaveValidArrivalRunwaysTest() public void TestItPassesOnValidArrivalRunway(string airport, string runway) { - this.sectorElements.Add(CoordinationPointFactory.MakeAirport(arrivalAirport: airport, arrivalRunway: runway)); + sectorElements.Add(CoordinationPointFactory.MakeAirport(arrivalAirport: airport, arrivalRunway: runway)); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Theory] @@ -41,9 +41,9 @@ public void TestItPassesOnValidArrivalRunway(string airport, string runway) [InlineData("EGSS", "04")] // Doesn't match up on the descriptions public void TestItFailsOnInvalidArrivalRunway(string airport, string runway) { - this.sectorElements.Add(CoordinationPointFactory.MakeAirport(arrivalAirport: airport, arrivalRunway: runway)); + sectorElements.Add(CoordinationPointFactory.MakeAirport(arrivalAirport: airport, arrivalRunway: runway)); - this.AssertValidationErrors(); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidDepartureRunwaysTest.cs b/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidDepartureRunwaysTest.cs index a534a19f..fa338914 100644 --- a/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidDepartureRunwaysTest.cs +++ b/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidDepartureRunwaysTest.cs @@ -8,12 +8,12 @@ public class AllCoordinationPointsMustHaveValidDepartureRunwaysTest: AbstractVal { public AllCoordinationPointsMustHaveValidDepartureRunwaysTest() { - this.sectorElements.Add(AirportFactory.Make("EGKK")); - this.sectorElements.Add(RunwayFactory.Make("EGKK", "26L", "09")); - this.sectorElements.Add(AirportFactory.Make("EGLL")); - this.sectorElements.Add(RunwayFactory.Make("EGLL", "09R", "09")); - this.sectorElements.Add(RunwayFactory.Make("EGLL", "09L", "09")); - this.sectorElements.Add(AirportFactory.Make("EGSS")); + sectorElements.Add(AirportFactory.Make("EGKK")); + sectorElements.Add(RunwayFactory.Make("EGKK", "26L", "09")); + sectorElements.Add(AirportFactory.Make("EGLL")); + sectorElements.Add(RunwayFactory.Make("EGLL", "09R", "09")); + sectorElements.Add(RunwayFactory.Make("EGLL", "09L", "09")); + sectorElements.Add(AirportFactory.Make("EGSS")); } [Theory] @@ -28,9 +28,9 @@ public AllCoordinationPointsMustHaveValidDepartureRunwaysTest() public void TestItPassesOnValidDepartureRunway(string airport, string runway) { - this.sectorElements.Add(CoordinationPointFactory.MakeAirport(departureAirport: airport, departureRunway: runway)); + sectorElements.Add(CoordinationPointFactory.MakeAirport(departureAirport: airport, departureRunway: runway)); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Theory] @@ -41,9 +41,9 @@ public void TestItPassesOnValidDepartureRunway(string airport, string runway) [InlineData("EGSS", "04")] // Doesn't have a runway public void TestItFailsOnInvalidDepartureRunway(string airport, string runway) { - this.sectorElements.Add(CoordinationPointFactory.MakeAirport(departureAirport: airport, departureRunway: runway)); + sectorElements.Add(CoordinationPointFactory.MakeAirport(departureAirport: airport, departureRunway: runway)); - this.AssertValidationErrors(); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidFixTest.cs b/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidFixTest.cs index b864890b..f8bc3bd8 100644 --- a/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidFixTest.cs +++ b/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidFixTest.cs @@ -8,10 +8,10 @@ public class AllCoordinationPointsMustHaveValidFixTest: AbstractValidatorTestCas { public AllCoordinationPointsMustHaveValidFixTest() { - this.sectorElements.Add(FixFactory.Make("testfix")); - this.sectorElements.Add(VorFactory.Make("testvor")); - this.sectorElements.Add(NdbFactory.Make("testndb")); - this.sectorElements.Add(AirportFactory.Make("testairport")); + sectorElements.Add(FixFactory.Make("testfix")); + sectorElements.Add(VorFactory.Make("testvor")); + sectorElements.Add(NdbFactory.Make("testndb")); + sectorElements.Add(AirportFactory.Make("testairport")); } [Theory] @@ -22,10 +22,10 @@ public AllCoordinationPointsMustHaveValidFixTest() [InlineData("testairport")] public void TestItPassesOnValidFix(string fix) { - this.sectorElements.Add(CoordinationPointFactory.Make(coordinationPoint: fix)); - this.sectorElements.Add(CoordinationPointFactory.Make(coordinationPoint: fix)); + sectorElements.Add(CoordinationPointFactory.Make(coordinationPoint: fix)); + sectorElements.Add(CoordinationPointFactory.Make(coordinationPoint: fix)); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Theory] @@ -35,10 +35,10 @@ public void TestItPassesOnValidFix(string fix) [InlineData("testairport", "nottestairport")] public void TestItFailsOnInvalidFix(string firstFix, string secondFix) { - this.sectorElements.Add(CoordinationPointFactory.Make(coordinationPoint: firstFix)); - this.sectorElements.Add(CoordinationPointFactory.Make(coordinationPoint: secondFix)); + sectorElements.Add(CoordinationPointFactory.Make(coordinationPoint: firstFix)); + sectorElements.Add(CoordinationPointFactory.Make(coordinationPoint: secondFix)); - this.AssertValidationErrors(); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidFromSectorTest.cs b/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidFromSectorTest.cs index 6c07b840..18116a02 100644 --- a/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidFromSectorTest.cs +++ b/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidFromSectorTest.cs @@ -8,8 +8,8 @@ public class AllCoordinationPointsMustHaveValidFromSectorTest: AbstractValidator { public AllCoordinationPointsMustHaveValidFromSectorTest() { - this.sectorElements.Add(SectorFactory.Make("COOL1")); - this.sectorElements.Add(SectorFactory.Make("COOL2")); + sectorElements.Add(SectorFactory.Make("COOL1")); + sectorElements.Add(SectorFactory.Make("COOL2")); } [Theory] @@ -17,10 +17,10 @@ public AllCoordinationPointsMustHaveValidFromSectorTest() [InlineData("COOL2")] public void TestItPassesOnValidToSector(string sector) { - this.sectorElements.Add(CoordinationPointFactory.Make(fromSector: sector)); - this.sectorElements.Add(CoordinationPointFactory.Make(fromSector: sector)); + sectorElements.Add(CoordinationPointFactory.Make(fromSector: sector)); + sectorElements.Add(CoordinationPointFactory.Make(fromSector: sector)); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Theory] @@ -28,10 +28,10 @@ public void TestItPassesOnValidToSector(string sector) [InlineData("NOTCOOL2","COOL2")] public void TestItFailsOnInvalidToSector(string firstSector, string secondSector) { - this.sectorElements.Add(CoordinationPointFactory.Make(fromSector: firstSector)); - this.sectorElements.Add(CoordinationPointFactory.Make(fromSector: secondSector)); + sectorElements.Add(CoordinationPointFactory.Make(fromSector: firstSector)); + sectorElements.Add(CoordinationPointFactory.Make(fromSector: secondSector)); - this.AssertValidationErrors(); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidNextTest.cs b/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidNextTest.cs index 4642f9a5..d5076c0f 100644 --- a/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidNextTest.cs +++ b/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidNextTest.cs @@ -8,10 +8,10 @@ public class AllCoordinationPointsMustHaveValidNextTest: AbstractValidatorTestCa { public AllCoordinationPointsMustHaveValidNextTest() { - this.sectorElements.Add(FixFactory.Make("testfix")); - this.sectorElements.Add(VorFactory.Make("testvor")); - this.sectorElements.Add(NdbFactory.Make("testndb")); - this.sectorElements.Add(AirportFactory.Make("testairport")); + sectorElements.Add(FixFactory.Make("testfix")); + sectorElements.Add(VorFactory.Make("testvor")); + sectorElements.Add(NdbFactory.Make("testndb")); + sectorElements.Add(AirportFactory.Make("testairport")); } [Theory] @@ -22,10 +22,10 @@ public AllCoordinationPointsMustHaveValidNextTest() [InlineData("EGGD")] public void TestItPassesOnValidNext(string fix) { - this.sectorElements.Add(CoordinationPointFactory.Make(nextPoint: fix)); - this.sectorElements.Add(CoordinationPointFactory.Make(nextPoint: fix)); + sectorElements.Add(CoordinationPointFactory.Make(nextPoint: fix)); + sectorElements.Add(CoordinationPointFactory.Make(nextPoint: fix)); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Theory] @@ -35,10 +35,10 @@ public void TestItPassesOnValidNext(string fix) [InlineData("EGGD", "EGG1")] public void TestItFailsOnInvalidNext(string firstFix, string secondFix) { - this.sectorElements.Add(CoordinationPointFactory.Make(nextPoint: firstFix)); - this.sectorElements.Add(CoordinationPointFactory.Make(nextPoint: secondFix)); + sectorElements.Add(CoordinationPointFactory.Make(nextPoint: firstFix)); + sectorElements.Add(CoordinationPointFactory.Make(nextPoint: secondFix)); - this.AssertValidationErrors(); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidPriorTest.cs b/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidPriorTest.cs index 8106f67d..a5836371 100644 --- a/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidPriorTest.cs +++ b/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidPriorTest.cs @@ -8,10 +8,10 @@ public class AllCoordinationPointsMustHaveValidPriorTest: AbstractValidatorTestC { public AllCoordinationPointsMustHaveValidPriorTest() { - this.sectorElements.Add(FixFactory.Make("testfix")); - this.sectorElements.Add(VorFactory.Make("testvor")); - this.sectorElements.Add(NdbFactory.Make("testndb")); - this.sectorElements.Add(AirportFactory.Make("testairport")); + sectorElements.Add(FixFactory.Make("testfix")); + sectorElements.Add(VorFactory.Make("testvor")); + sectorElements.Add(NdbFactory.Make("testndb")); + sectorElements.Add(AirportFactory.Make("testairport")); } [Theory] @@ -22,10 +22,10 @@ public AllCoordinationPointsMustHaveValidPriorTest() [InlineData("EGGD")] public void TestItPassesOnValidPrior(string fix) { - this.sectorElements.Add(CoordinationPointFactory.Make(priorPoint: fix)); - this.sectorElements.Add(CoordinationPointFactory.Make(priorPoint: fix)); + sectorElements.Add(CoordinationPointFactory.Make(priorPoint: fix)); + sectorElements.Add(CoordinationPointFactory.Make(priorPoint: fix)); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Theory] @@ -35,10 +35,10 @@ public void TestItPassesOnValidPrior(string fix) [InlineData("EGGD", "EGG1")] public void TestItFailsOnInvalidPrior(string firstFix, string secondFix) { - this.sectorElements.Add(CoordinationPointFactory.Make(priorPoint: firstFix)); - this.sectorElements.Add(CoordinationPointFactory.Make(priorPoint: secondFix)); + sectorElements.Add(CoordinationPointFactory.Make(priorPoint: firstFix)); + sectorElements.Add(CoordinationPointFactory.Make(priorPoint: secondFix)); - this.AssertValidationErrors(); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidToSectorTest.cs b/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidToSectorTest.cs index bceea842..611478fa 100644 --- a/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidToSectorTest.cs +++ b/tests/CompilerTest/Validate/AllCoordinationPointsMustHaveValidToSectorTest.cs @@ -8,8 +8,8 @@ public class AllCoordinationPointsMustHaveValidToSectorTest: AbstractValidatorTe { public AllCoordinationPointsMustHaveValidToSectorTest() { - this.sectorElements.Add(SectorFactory.Make("COOL1")); - this.sectorElements.Add(SectorFactory.Make("COOL2")); + sectorElements.Add(SectorFactory.Make("COOL1")); + sectorElements.Add(SectorFactory.Make("COOL2")); } [Theory] @@ -17,10 +17,10 @@ public AllCoordinationPointsMustHaveValidToSectorTest() [InlineData("COOL2")] public void TestItPassesOnValidToSector(string sector) { - this.sectorElements.Add(CoordinationPointFactory.Make(toSector: sector)); - this.sectorElements.Add(CoordinationPointFactory.Make(toSector: sector)); + sectorElements.Add(CoordinationPointFactory.Make(toSector: sector)); + sectorElements.Add(CoordinationPointFactory.Make(toSector: sector)); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Theory] @@ -28,10 +28,10 @@ public void TestItPassesOnValidToSector(string sector) [InlineData("NOTCOOL2","COOL2")] public void TestItFailsOnInvalidToSector(string firstSector, string secondSector) { - this.sectorElements.Add(CoordinationPointFactory.Make(toSector: firstSector)); - this.sectorElements.Add(CoordinationPointFactory.Make(toSector: secondSector)); + sectorElements.Add(CoordinationPointFactory.Make(toSector: firstSector)); + sectorElements.Add(CoordinationPointFactory.Make(toSector: secondSector)); - this.AssertValidationErrors(); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllFixesMustBeUniqueTest.cs b/tests/CompilerTest/Validate/AllFixesMustBeUniqueTest.cs index deea5152..20196479 100644 --- a/tests/CompilerTest/Validate/AllFixesMustBeUniqueTest.cs +++ b/tests/CompilerTest/Validate/AllFixesMustBeUniqueTest.cs @@ -14,37 +14,37 @@ public class AllFixesMustBeUniqueTest: AbstractValidatorTestCase public AllFixesMustBeUniqueTest() { - this.first = FixFactory.Make("DIKAS", new Coordinate("abc", "def")); - this.second = FixFactory.Make("DIKAS", new Coordinate("abd", "cef")); - this.third = FixFactory.Make("DIKAP", new Coordinate("abc", "def")); - this.fourth = FixFactory.Make("DIKAS", new Coordinate("abc", "def")); + first = FixFactory.Make("DIKAS", new Coordinate("abc", "def")); + second = FixFactory.Make("DIKAS", new Coordinate("abd", "cef")); + third = FixFactory.Make("DIKAP", new Coordinate("abc", "def")); + fourth = FixFactory.Make("DIKAS", new Coordinate("abc", "def")); } [Fact] public void TestItPassesIfCoordinatesDifferent() { - this.sectorElements.Add(this.first); - this.sectorElements.Add(this.second); + sectorElements.Add(first); + sectorElements.Add(second); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] public void TestItPassesIfIdentifiersDifferent() { - this.sectorElements.Add(this.first); - this.sectorElements.Add(this.third); + sectorElements.Add(first); + sectorElements.Add(third); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] public void TestItFailsIfThereAreDuplicates() { - this.sectorElements.Add(this.first); - this.sectorElements.Add(this.fourth); + sectorElements.Add(first); + sectorElements.Add(fourth); - this.AssertValidationErrors(); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllGeoMustHaveValidColoursTest.cs b/tests/CompilerTest/Validate/AllGeoMustHaveValidColoursTest.cs index 9bed785a..37cc610d 100644 --- a/tests/CompilerTest/Validate/AllGeoMustHaveValidColoursTest.cs +++ b/tests/CompilerTest/Validate/AllGeoMustHaveValidColoursTest.cs @@ -10,13 +10,13 @@ public class AllGeoMustHaveValidColoursTest: AbstractValidatorTestCase { public AllGeoMustHaveValidColoursTest() { - this.sectorElements.Add(ColourFactory.Make("colour1")); + sectorElements.Add(ColourFactory.Make("colour1")); } [Fact] public void TestItPassesOnValidColoursIntegers() { - this.sectorElements.Add(GeoFactory.Make( + sectorElements.Add(GeoFactory.Make( "55", new List { @@ -24,13 +24,13 @@ public void TestItPassesOnValidColoursIntegers() } )); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] public void TestItPassesOnValidDefinedColours() { - this.sectorElements.Add(GeoFactory.Make( + sectorElements.Add(GeoFactory.Make( "colour1", new List { @@ -38,13 +38,13 @@ public void TestItPassesOnValidDefinedColours() } )); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnInvalidDefinedColours() { - this.sectorElements.Add(GeoFactory.Make( + sectorElements.Add(GeoFactory.Make( "notcolour1", new List { @@ -52,13 +52,13 @@ public void TestItFailsOnInvalidDefinedColours() } )); - this.AssertValidationErrors(2); + AssertValidationErrors(2); } [Fact] public void TestItFailsOnInvalidDefinedColoursAfterLooping() { - this.sectorElements.Add(GeoFactory.Make( + sectorElements.Add(GeoFactory.Make( "colour1", new List { @@ -66,7 +66,7 @@ public void TestItFailsOnInvalidDefinedColoursAfterLooping() } )); - this.sectorElements.Add(GeoFactory.Make( + sectorElements.Add(GeoFactory.Make( "notcolour1", new List { @@ -74,13 +74,13 @@ public void TestItFailsOnInvalidDefinedColoursAfterLooping() } )); - this.AssertValidationErrors(2); + AssertValidationErrors(2); } [Fact] public void TestItFailsOnInvalidColourIntegers() { - this.sectorElements.Add(GeoFactory.Make( + sectorElements.Add(GeoFactory.Make( "123456789", new List { @@ -88,7 +88,7 @@ public void TestItFailsOnInvalidColourIntegers() } )); - this.AssertValidationErrors(2); + AssertValidationErrors(2); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllGeoMustHaveValidPointsTest.cs b/tests/CompilerTest/Validate/AllGeoMustHaveValidPointsTest.cs index cbc95cd7..7f5be245 100644 --- a/tests/CompilerTest/Validate/AllGeoMustHaveValidPointsTest.cs +++ b/tests/CompilerTest/Validate/AllGeoMustHaveValidPointsTest.cs @@ -10,16 +10,16 @@ public class AllGeoMustHaveValidPointsTest: AbstractValidatorTestCase { public AllGeoMustHaveValidPointsTest() { - this.sectorElements.Add(FixFactory.Make("testfix")); - this.sectorElements.Add(VorFactory.Make("testvor")); - this.sectorElements.Add(NdbFactory.Make("testndb")); - this.sectorElements.Add(AirportFactory.Make("testairport")); + sectorElements.Add(FixFactory.Make("testfix")); + sectorElements.Add(VorFactory.Make("testvor")); + sectorElements.Add(NdbFactory.Make("testndb")); + sectorElements.Add(AirportFactory.Make("testairport")); } [Fact] public void TestItPassesOnValidPoints() { - this.sectorElements.Add(GeoFactory.Make( + sectorElements.Add(GeoFactory.Make( firstPoint: new Point("testndb"), secondPoint: new Point("testairport"), additionalSegments: new List @@ -28,7 +28,7 @@ public void TestItPassesOnValidPoints() } )); - this.sectorElements.Add(GeoFactory.Make( + sectorElements.Add(GeoFactory.Make( firstPoint: new Point("testfix"), secondPoint: new Point("testvor"), additionalSegments: new List @@ -37,13 +37,13 @@ public void TestItPassesOnValidPoints() } )); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnInvalidPoint() { - this.sectorElements.Add(GeoFactory.Make( + sectorElements.Add(GeoFactory.Make( firstPoint: new Point("nottestndb"), secondPoint: new Point("testairport"), additionalSegments: new List @@ -52,7 +52,7 @@ public void TestItFailsOnInvalidPoint() } )); - this.sectorElements.Add(GeoFactory.Make( + sectorElements.Add(GeoFactory.Make( firstPoint: new Point("testndb"), secondPoint: new Point("nottestairport"), additionalSegments: new List @@ -61,7 +61,7 @@ public void TestItFailsOnInvalidPoint() } )); - this.AssertValidationErrors(4); + AssertValidationErrors(4); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllLabelsMustHaveAValidColourTest.cs b/tests/CompilerTest/Validate/AllLabelsMustHaveAValidColourTest.cs index 9c35ee55..034fbdcb 100644 --- a/tests/CompilerTest/Validate/AllLabelsMustHaveAValidColourTest.cs +++ b/tests/CompilerTest/Validate/AllLabelsMustHaveAValidColourTest.cs @@ -8,25 +8,25 @@ public class AllLabelsMustHaveAValidColourTest: AbstractValidatorTestCase { public AllLabelsMustHaveAValidColourTest() { - this.sectorElements.Add(ColourFactory.Make("colour1")); + sectorElements.Add(ColourFactory.Make("colour1")); } [Fact] public void TestItPassesOnValidColours() { - this.sectorElements.Labels.Add(LabelFactory.Make(colour: "colour1")); - this.sectorElements.Labels.Add(LabelFactory.Make(colour: "123")); + sectorElements.Labels.Add(LabelFactory.Make(colour: "colour1")); + sectorElements.Labels.Add(LabelFactory.Make(colour: "123")); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnInvalidColours() { - this.sectorElements.Labels.Add(LabelFactory.Make(colour: "colour2")); - this.sectorElements.Labels.Add(LabelFactory.Make(colour: "-123")); + sectorElements.Labels.Add(LabelFactory.Make(colour: "colour2")); + sectorElements.Labels.Add(LabelFactory.Make(colour: "-123")); - this.AssertValidationErrors(2); + AssertValidationErrors(2); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllRegionsMustHaveValidColoursTest.cs b/tests/CompilerTest/Validate/AllRegionsMustHaveValidColoursTest.cs index 1e3c54f3..60efc7e8 100644 --- a/tests/CompilerTest/Validate/AllRegionsMustHaveValidColoursTest.cs +++ b/tests/CompilerTest/Validate/AllRegionsMustHaveValidColoursTest.cs @@ -8,25 +8,25 @@ public class AllRegionsMustHaveAValidColourTest: AbstractValidatorTestCase { public AllRegionsMustHaveAValidColourTest() { - this.sectorElements.Add(ColourFactory.Make("colour1")); + sectorElements.Add(ColourFactory.Make("colour1")); } [Fact] public void TestItPassesOnValidColours() { - this.sectorElements.Add(RegionFactory.Make("colour1")); - this.sectorElements.Add(RegionFactory.Make("123")); + sectorElements.Add(RegionFactory.Make("colour1")); + sectorElements.Add(RegionFactory.Make("123")); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnInvalidColours() { - this.sectorElements.Add(RegionFactory.Make("colour2")); - this.sectorElements.Add(RegionFactory.Make("-123")); + sectorElements.Add(RegionFactory.Make("colour2")); + sectorElements.Add(RegionFactory.Make("-123")); - this.AssertValidationErrors(4); + AssertValidationErrors(4); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllRegionsMustHaveValidPointsTest.cs b/tests/CompilerTest/Validate/AllRegionsMustHaveValidPointsTest.cs index 4f69392f..d9573b7f 100644 --- a/tests/CompilerTest/Validate/AllRegionsMustHaveValidPointsTest.cs +++ b/tests/CompilerTest/Validate/AllRegionsMustHaveValidPointsTest.cs @@ -10,28 +10,28 @@ public class AllRegionsMustHaveValidPointsTest: AbstractValidatorTestCase { public AllRegionsMustHaveValidPointsTest() { - this.sectorElements.Add(FixFactory.Make("testfix")); - this.sectorElements.Add(VorFactory.Make("testvor")); - this.sectorElements.Add(NdbFactory.Make("testndb")); - this.sectorElements.Add(AirportFactory.Make("testairport")); + sectorElements.Add(FixFactory.Make("testfix")); + sectorElements.Add(VorFactory.Make("testvor")); + sectorElements.Add(NdbFactory.Make("testndb")); + sectorElements.Add(AirportFactory.Make("testairport")); } [Fact] public void TestItPassesOnValidPoints() { - this.sectorElements.Add(RegionFactory.Make(points: new List() {new("testfix"), new("testndb")})); - this.sectorElements.Add(RegionFactory.Make(points: new List() {new("testvor"), new("testairport")})); + sectorElements.Add(RegionFactory.Make(points: new List {new("testfix"), new("testndb")})); + sectorElements.Add(RegionFactory.Make(points: new List {new("testvor"), new("testairport")})); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnInvalidPoint() { - this.sectorElements.Add(RegionFactory.Make(points: new List() {new("nottestfix"), new("nottestndb")})); - this.sectorElements.Add(RegionFactory.Make(points: new List() {new("nottestvor"), new("nottestairport")})); + sectorElements.Add(RegionFactory.Make(points: new List {new("nottestfix"), new("nottestndb")})); + sectorElements.Add(RegionFactory.Make(points: new List {new("nottestvor"), new("nottestairport")})); - this.AssertValidationErrors(4); + AssertValidationErrors(4); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllRunwayExitsMustHaveAValidRunwayTest.cs b/tests/CompilerTest/Validate/AllRunwayExitsMustHaveAValidRunwayTest.cs new file mode 100644 index 00000000..5d438d1d --- /dev/null +++ b/tests/CompilerTest/Validate/AllRunwayExitsMustHaveAValidRunwayTest.cs @@ -0,0 +1,91 @@ +using System.Collections.Generic; +using Xunit; +using Compiler.Model; +using Compiler.Validate; +using CompilerTest.Bogus.Factory; + +namespace CompilerTest.Validate +{ + public class AllRunwayExitsMustHaveAValidRunwayTest: AbstractValidatorTestCase + { + public AllRunwayExitsMustHaveAValidRunwayTest() + { + sectorElements.Add(AirportFactory.Make("EGKK")); + sectorElements.Add(AirportFactory.Make("EGLL")); + sectorElements.Add(AirportFactory.Make("EGCC")); + sectorElements.Add(RunwayFactory.Make("EGKK", "26L", "09")); + sectorElements.Add(RunwayFactory.Make("EGLL", "27L", "09")); + sectorElements.Add(RunwayFactory.Make("EGLL", "27R", "09")); + sectorElements.Add(RunwayFactory.Make("EGCC", "23L", "09")); + } + + [Theory] + [InlineData("EGCC", "23L", "EGLL", "27R")] + [InlineData("EGLL", "27L", "EGLL", "27R")] + [InlineData("EGKK", "26L", "EGCC", "23L")] + [InlineData("EGCC", "23L", "EGCC", "23L")] + public void TestItPassesOnAllValid(string firstAirport, string firstRunway, string secondAirport, string secondRunway) + { + sectorElements.Add( + GroundNetworkFactory.Make( + firstAirport, + new List + { + GroundNetworkRunwayExitFactory.Make(firstRunway), + GroundNetworkRunwayExitFactory.Make(firstRunway) + } + ) + ); + + sectorElements.Add( + GroundNetworkFactory.Make( + secondAirport, + new List + { + GroundNetworkRunwayExitFactory.Make(secondRunway), + GroundNetworkRunwayExitFactory.Make(secondRunway) + } + ) + ); + + AssertNoValidationErrors(); + } + + [Theory] + [InlineData("EGCC", "23R", "EGLL", "27R", 1)] + [InlineData("EGKK", "27L", "EGLL", "27R", 1)] + [InlineData("EGLL", "26R", "EGLL", "23L", 2)] + [InlineData("000A", "01", "000A", "00", 2)] + public void TestItFailsOnInvalid(string firstAirport, string firstRunway, string secondAirport, string secondRunway, int failTimes) + { + sectorElements.Add( + GroundNetworkFactory.Make( + firstAirport, + new List + { + GroundNetworkRunwayExitFactory.Make(firstRunway), + GroundNetworkRunwayExitFactory.Make(firstRunway) + } + ) + ); + + sectorElements.Add( + GroundNetworkFactory.Make( + secondAirport, + new List + { + GroundNetworkRunwayExitFactory.Make(secondRunway), + GroundNetworkRunwayExitFactory.Make(secondRunway) + } + ) + ); + + AssertValidationErrors(failTimes); + } + + protected override IValidationRule GetValidationRule() + { + return new AllRunwayExitsMustHaveAValidRunway(); + } + } +} diff --git a/tests/CompilerTest/Validate/AllRunwaysMustReferenceAnAirportTest.cs b/tests/CompilerTest/Validate/AllRunwaysMustReferenceAnAirportTest.cs index 9b5f048b..601ff8e6 100644 --- a/tests/CompilerTest/Validate/AllRunwaysMustReferenceAnAirportTest.cs +++ b/tests/CompilerTest/Validate/AllRunwaysMustReferenceAnAirportTest.cs @@ -10,30 +10,30 @@ public class AllRunwaysMustReferenceAnAirportTest: AbstractValidatorTestCase { public AllRunwaysMustReferenceAnAirportTest() { - this.loggerMock = new Mock(); - this.sectorElements.Add(AirportFactory.Make("EGKK")); - this.sectorElements.Add(AirportFactory.Make("EGLL")); - this.sectorElements.Add(AirportFactory.Make("000A")); + loggerMock = new Mock(); + sectorElements.Add(AirportFactory.Make("EGKK")); + sectorElements.Add(AirportFactory.Make("EGLL")); + sectorElements.Add(AirportFactory.Make("000A")); } [Fact] public void TestItPassesOnValidReferences() { - this.sectorElements.Add(RunwayFactory.Make("EGKK")); - this.sectorElements.Add(RunwayFactory.Make("EGLL")); - this.sectorElements.Add(RunwayFactory.Make("000A")); + sectorElements.Add(RunwayFactory.Make("EGKK")); + sectorElements.Add(RunwayFactory.Make("EGLL")); + sectorElements.Add(RunwayFactory.Make("000A")); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnInvalidReferences() { - this.sectorElements.Add(RunwayFactory.Make("EGSS")); - this.sectorElements.Add(RunwayFactory.Make("EGGW")); - this.sectorElements.Add(RunwayFactory.Make("000A")); + sectorElements.Add(RunwayFactory.Make("EGSS")); + sectorElements.Add(RunwayFactory.Make("EGGW")); + sectorElements.Add(RunwayFactory.Make("000A")); - this.AssertValidationErrors(2); + AssertValidationErrors(2); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllSctSidsMustHaveAValidRouteTest.cs b/tests/CompilerTest/Validate/AllSctSidsMustHaveAValidRouteTest.cs index 26e909cc..c5427617 100644 --- a/tests/CompilerTest/Validate/AllSctSidsMustHaveAValidRouteTest.cs +++ b/tests/CompilerTest/Validate/AllSctSidsMustHaveAValidRouteTest.cs @@ -10,18 +10,18 @@ public class AllSctSidsMustHaveAValidRouteTest: AbstractValidatorTestCase { public AllSctSidsMustHaveAValidRouteTest() { - this.sectorElements.Add(FixFactory.Make("testfix")); - this.sectorElements.Add(VorFactory.Make("testvor")); - this.sectorElements.Add(NdbFactory.Make("testndb")); - this.sectorElements.Add(AirportFactory.Make("testairport")); + sectorElements.Add(FixFactory.Make("testfix")); + sectorElements.Add(VorFactory.Make("testvor")); + sectorElements.Add(NdbFactory.Make("testndb")); + sectorElements.Add(AirportFactory.Make("testairport")); } [Fact] public void TestItPassesOnValidRoute() { - this.sectorElements.Add( + sectorElements.Add( SidStarRouteFactory.Make( - segments: new List() + segments: new List { RouteSegmentFactory.MakeDoublePoint("testfix", "testvor"), RouteSegmentFactory.MakeDoublePoint("testvor", "testndb"), @@ -32,15 +32,15 @@ public void TestItPassesOnValidRoute() ) ); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnBadFix() { - this.sectorElements.Add( + sectorElements.Add( SidStarRouteFactory.Make( - segments: new List() + segments: new List { RouteSegmentFactory.MakeDoublePoint("testfix", "testvor"), RouteSegmentFactory.MakeDoublePoint("testvor", "testndb"), @@ -51,16 +51,16 @@ public void TestItFailsOnBadFix() ) ); - this.sectorElements.Fixes.Clear(); - this.AssertValidationErrors(2); + sectorElements.Fixes.Clear(); + AssertValidationErrors(2); } [Fact] public void TestItFailsOnBadVor() { - this.sectorElements.Add( + sectorElements.Add( SidStarRouteFactory.Make( - segments: new List() + segments: new List { RouteSegmentFactory.MakeDoublePoint("testfix", "testvor"), RouteSegmentFactory.MakeDoublePoint("testvor", "testndb"), @@ -71,16 +71,16 @@ public void TestItFailsOnBadVor() ) ); - this.sectorElements.Vors.Clear(); - this.AssertValidationErrors(3); + sectorElements.Vors.Clear(); + AssertValidationErrors(3); } [Fact] public void TestItFailsOnBadNdb() { - this.sectorElements.Add( + sectorElements.Add( SidStarRouteFactory.Make( - segments: new List() + segments: new List { RouteSegmentFactory.MakeDoublePoint("testfix", "testvor"), RouteSegmentFactory.MakeDoublePoint("testvor", "testndb"), @@ -91,16 +91,16 @@ public void TestItFailsOnBadNdb() ) ); - this.sectorElements.Ndbs.Clear(); - this.AssertValidationErrors(2); + sectorElements.Ndbs.Clear(); + AssertValidationErrors(2); } [Fact] public void TestItFailsOnBadAirport() { - this.sectorElements.Add( + sectorElements.Add( SidStarRouteFactory.Make( - segments: new List() + segments: new List { RouteSegmentFactory.MakeDoublePoint("testfix", "testvor"), RouteSegmentFactory.MakeDoublePoint("testvor", "testndb"), @@ -111,8 +111,8 @@ public void TestItFailsOnBadAirport() ) ); - this.sectorElements.Airports.Clear(); - this.AssertValidationErrors(2); + sectorElements.Airports.Clear(); + AssertValidationErrors(2); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllSctSidsMustHaveValidColoursTest.cs b/tests/CompilerTest/Validate/AllSctSidsMustHaveValidColoursTest.cs index 44bc0bb6..84ce22b3 100644 --- a/tests/CompilerTest/Validate/AllSctSidsMustHaveValidColoursTest.cs +++ b/tests/CompilerTest/Validate/AllSctSidsMustHaveValidColoursTest.cs @@ -10,15 +10,15 @@ public class AllSctSidsMustHaveValidColoursTest: AbstractValidatorTestCase { public AllSctSidsMustHaveValidColoursTest() { - this.sectorElements.Add(ColourFactory.Make("colour1")); + sectorElements.Add(ColourFactory.Make("colour1")); } [Fact] public void TestItPassesOnValidColoursIntegers() { - this.sectorElements.Add( + sectorElements.Add( SidStarRouteFactory.Make( - segments: new List() + segments: new List { RouteSegmentFactory.MakeDoublePoint(colour: "255"), RouteSegmentFactory.MakeDoublePoint(colour: "266"), @@ -27,15 +27,15 @@ public void TestItPassesOnValidColoursIntegers() ) ); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] public void TestItPassesOnValidDefinedColours() { - this.sectorElements.Add( + sectorElements.Add( SidStarRouteFactory.Make( - segments: new List() + segments: new List { RouteSegmentFactory.MakeDoublePoint(colour: "colour1"), RouteSegmentFactory.MakeDoublePoint(colour: "colour1"), @@ -44,15 +44,15 @@ public void TestItPassesOnValidDefinedColours() ) ); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] public void TestItPassesOnNullColours() { - this.sectorElements.Add( + sectorElements.Add( SidStarRouteFactory.Make( - segments: new List() + segments: new List { RouteSegmentFactory.MakeDoublePointWithNoColour(), RouteSegmentFactory.MakeDoublePointWithNoColour(), @@ -61,15 +61,15 @@ public void TestItPassesOnNullColours() ) ); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnInvalidDefinedColours() { - this.sectorElements.Add( + sectorElements.Add( SidStarRouteFactory.Make( - segments: new List() + segments: new List { RouteSegmentFactory.MakeDoublePoint(colour: "colour1"), RouteSegmentFactory.MakeDoublePoint(colour: "colour2"), @@ -78,15 +78,15 @@ public void TestItFailsOnInvalidDefinedColours() ) ); - this.AssertValidationErrors(); + AssertValidationErrors(); } [Fact] public void TestItFailsOnInvalidDefinedColoursAfterLooping() { - this.sectorElements.Add( + sectorElements.Add( SidStarRouteFactory.Make( - segments: new List() + segments: new List { RouteSegmentFactory.MakeDoublePoint(colour: "colour1"), RouteSegmentFactory.MakeDoublePoint(colour: "colour1"), @@ -95,15 +95,15 @@ public void TestItFailsOnInvalidDefinedColoursAfterLooping() ) ); - this.AssertValidationErrors(); + AssertValidationErrors(); } [Fact] public void TestItFailsOnInvalidColourIntegers() { - this.sectorElements.Add( + sectorElements.Add( SidStarRouteFactory.Make( - segments: new List() + segments: new List { RouteSegmentFactory.MakeDoublePoint(colour: "255"), RouteSegmentFactory.MakeDoublePoint(colour: "-1"), @@ -112,15 +112,15 @@ public void TestItFailsOnInvalidColourIntegers() ) ); - this.AssertValidationErrors(); + AssertValidationErrors(); } [Fact] public void TestItFailsOnInvalidColourIntegersAfterLooping() { - this.sectorElements.Add( + sectorElements.Add( SidStarRouteFactory.Make( - segments: new List() + segments: new List { RouteSegmentFactory.MakeDoublePoint(colour: "255"), RouteSegmentFactory.MakeDoublePoint(colour: "255"), @@ -129,7 +129,7 @@ public void TestItFailsOnInvalidColourIntegersAfterLooping() ) ); - this.AssertValidationErrors(); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllSctStarsMustHaveAValidRouteTest.cs b/tests/CompilerTest/Validate/AllSctStarsMustHaveAValidRouteTest.cs index db62c454..c609d0b6 100644 --- a/tests/CompilerTest/Validate/AllSctStarsMustHaveAValidRouteTest.cs +++ b/tests/CompilerTest/Validate/AllSctStarsMustHaveAValidRouteTest.cs @@ -10,10 +10,10 @@ public class AllSctStarsMustHaveAValidRouteTest: AbstractValidatorTestCase { public AllSctStarsMustHaveAValidRouteTest() { - this.sectorElements.Add(FixFactory.Make("testfix")); - this.sectorElements.Add(VorFactory.Make("testvor")); - this.sectorElements.Add(NdbFactory.Make("testndb")); - this.sectorElements.Add(AirportFactory.Make("testairport")); + sectorElements.Add(FixFactory.Make("testfix")); + sectorElements.Add(VorFactory.Make("testvor")); + sectorElements.Add(NdbFactory.Make("testndb")); + sectorElements.Add(AirportFactory.Make("testairport")); } [Fact] @@ -37,9 +37,9 @@ public void TestItPassesOnValidRoute() CommentFactory.Make() ); - this.sectorElements.Add(route); + sectorElements.Add(route); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] @@ -63,10 +63,10 @@ public void TestItFailsOnBadFix() CommentFactory.Make() ); - this.sectorElements.Add(route); - this.sectorElements.Fixes.Clear(); + sectorElements.Add(route); + sectorElements.Fixes.Clear(); - this.AssertValidationErrors(); + AssertValidationErrors(); } [Fact] @@ -90,10 +90,10 @@ public void TestItFailsOnBadVor() CommentFactory.Make() ); - this.sectorElements.Add(route); - this.sectorElements.Vors.Clear(); + sectorElements.Add(route); + sectorElements.Vors.Clear(); - this.AssertValidationErrors(); + AssertValidationErrors(); } [Fact] @@ -117,10 +117,10 @@ public void TestItFailsOnBadNdb() CommentFactory.Make() ); - this.sectorElements.Add(route); - this.sectorElements.Ndbs.Clear(); + sectorElements.Add(route); + sectorElements.Ndbs.Clear(); - this.AssertValidationErrors(2); + AssertValidationErrors(2); } [Fact] @@ -144,10 +144,10 @@ public void TestItFailsOnBadAirport() CommentFactory.Make() ); - this.sectorElements.Add(route); - this.sectorElements.Airports.Clear(); + sectorElements.Add(route); + sectorElements.Airports.Clear(); - this.AssertValidationErrors(2); + AssertValidationErrors(2); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllSctStarsMustHaveValidColoursTest.cs b/tests/CompilerTest/Validate/AllSctStarsMustHaveValidColoursTest.cs index 6cb4c960..c210725e 100644 --- a/tests/CompilerTest/Validate/AllSctStarsMustHaveValidColoursTest.cs +++ b/tests/CompilerTest/Validate/AllSctStarsMustHaveValidColoursTest.cs @@ -10,16 +10,16 @@ public class AllSctStarsMustHaveValidColoursTest: AbstractValidatorTestCase { public AllSctStarsMustHaveValidColoursTest() { - this.sectorElements.Add(ColourFactory.Make("colour1")); + sectorElements.Add(ColourFactory.Make("colour1")); } [Fact] public void TestItPassesOnValidColoursIntegers() { - this.sectorElements.Add( + sectorElements.Add( SidStarRouteFactory.Make( SidStarType.STAR, - new List() + new List { RouteSegmentFactory.MakeDoublePoint(colour: "255"), RouteSegmentFactory.MakeDoublePoint(colour: "266"), @@ -28,16 +28,16 @@ public void TestItPassesOnValidColoursIntegers() ) ); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] public void TestItPassesOnValidDefinedColours() { - this.sectorElements.Add( + sectorElements.Add( SidStarRouteFactory.Make( SidStarType.STAR, - new List() + new List { RouteSegmentFactory.MakeDoublePoint(colour: "colour1"), RouteSegmentFactory.MakeDoublePoint(colour: "colour1"), @@ -46,16 +46,16 @@ public void TestItPassesOnValidDefinedColours() ) ); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] public void TestItPassesOnNullColours() { - this.sectorElements.Add( + sectorElements.Add( SidStarRouteFactory.Make( SidStarType.STAR, - new List() + new List { RouteSegmentFactory.MakeDoublePointWithNoColour(), RouteSegmentFactory.MakeDoublePointWithNoColour(), @@ -64,16 +64,16 @@ public void TestItPassesOnNullColours() ) ); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnInvalidDefinedColours() { - this.sectorElements.Add( + sectorElements.Add( SidStarRouteFactory.Make( SidStarType.STAR, - new List() + new List { RouteSegmentFactory.MakeDoublePoint(colour: "colour1"), RouteSegmentFactory.MakeDoublePoint(colour: "colour2"), @@ -82,16 +82,16 @@ public void TestItFailsOnInvalidDefinedColours() ) ); - this.AssertValidationErrors(); + AssertValidationErrors(); } [Fact] public void TestItFailsOnInvalidDefinedColoursAfterLooping() { - this.sectorElements.Add( + sectorElements.Add( SidStarRouteFactory.Make( SidStarType.STAR, - new List() + new List { RouteSegmentFactory.MakeDoublePoint(colour: "colour1"), RouteSegmentFactory.MakeDoublePoint(colour: "colour1"), @@ -100,16 +100,16 @@ public void TestItFailsOnInvalidDefinedColoursAfterLooping() ) ); - this.AssertValidationErrors(); + AssertValidationErrors(); } [Fact] public void TestItFailsOnInvalidColourIntegers() { - this.sectorElements.Add( + sectorElements.Add( SidStarRouteFactory.Make( SidStarType.STAR, - new List() + new List { RouteSegmentFactory.MakeDoublePoint(colour: "255"), RouteSegmentFactory.MakeDoublePoint(colour: "-1"), @@ -118,16 +118,16 @@ public void TestItFailsOnInvalidColourIntegers() ) ); - this.AssertValidationErrors(); + AssertValidationErrors(); } [Fact] public void TestItFailsOnInvalidColourIntegersAfterLooping() { - this.sectorElements.Add( + sectorElements.Add( SidStarRouteFactory.Make( SidStarType.STAR, - new List() + new List { RouteSegmentFactory.MakeDoublePoint(colour: "255"), RouteSegmentFactory.MakeDoublePoint(colour: "255"), @@ -136,7 +136,7 @@ public void TestItFailsOnInvalidColourIntegersAfterLooping() ) ); - this.AssertValidationErrors(); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllSectorlineElementsMustHaveUniqueNameTest.cs b/tests/CompilerTest/Validate/AllSectorlineElementsMustHaveUniqueNameTest.cs index 972c4fe4..d6e24fee 100644 --- a/tests/CompilerTest/Validate/AllSectorlineElementsMustHaveUniqueNameTest.cs +++ b/tests/CompilerTest/Validate/AllSectorlineElementsMustHaveUniqueNameTest.cs @@ -24,9 +24,9 @@ public class AllSectorlineElementsMustHaveUniqueNameTest public AllSectorlineElementsMustHaveUniqueNameTest() { - this.sectorElements = new SectorElementCollection(); - this.loggerMock = new Mock(); - this.first = new Sectorline( + sectorElements = new SectorElementCollection(); + loggerMock = new Mock(); + first = new Sectorline( "ONE", SectorLineDisplayRuleFactory.MakeList(2), SectorlineCoordinateFactory.MakeList(2), @@ -34,7 +34,7 @@ public AllSectorlineElementsMustHaveUniqueNameTest() DocblockFactory.Make(), CommentFactory.Make() ); - this.second = new Sectorline( + second = new Sectorline( "ONE", SectorLineDisplayRuleFactory.MakeList(2), SectorlineCoordinateFactory.MakeList(2), @@ -42,7 +42,7 @@ public AllSectorlineElementsMustHaveUniqueNameTest() DocblockFactory.Make(), CommentFactory.Make() ); - this.third = new Sectorline( + third = new Sectorline( "NOTONE", SectorLineDisplayRuleFactory.MakeList(2), SectorlineCoordinateFactory.MakeList(2), @@ -50,7 +50,7 @@ public AllSectorlineElementsMustHaveUniqueNameTest() DocblockFactory.Make(), CommentFactory.Make() ); - this.fourth = new CircleSectorline( + fourth = new CircleSectorline( "ONE", "EGGD", 5.5, @@ -59,7 +59,7 @@ public AllSectorlineElementsMustHaveUniqueNameTest() DocblockFactory.Make(), CommentFactory.Make() ); - this.fifth = new CircleSectorline( + fifth = new CircleSectorline( "NOTONEORTWO", "EGGD", 5.5, @@ -68,7 +68,7 @@ public AllSectorlineElementsMustHaveUniqueNameTest() DocblockFactory.Make(), CommentFactory.Make() ); - this.sixth = new CircleSectorline( + sixth = new CircleSectorline( "ONE", "EGGD", 5.5, @@ -77,53 +77,53 @@ public AllSectorlineElementsMustHaveUniqueNameTest() DocblockFactory.Make(), CommentFactory.Make() ); - this.rule = new AllSectorlineElementsMustHaveUniqueName(); - this.args = new CompilerArguments(); + rule = new AllSectorlineElementsMustHaveUniqueName(); + args = new CompilerArguments(); } [Fact] public void TestItPassesIfAllNamesDifferent() { - this.sectorElements.Add(this.first); - this.sectorElements.Add(this.third); - this.sectorElements.Add(this.fifth); - this.rule.Validate(sectorElements, this.args, this.loggerMock.Object); + sectorElements.Add(first); + sectorElements.Add(third); + sectorElements.Add(fifth); + rule.Validate(sectorElements, args, loggerMock.Object); - this.loggerMock.Verify(foo => foo.AddEvent(It.IsAny()), Times.Never); + loggerMock.Verify(foo => foo.AddEvent(It.IsAny()), Times.Never); } [Fact] public void TestItFailsOnNameClashTwoSectorlines() { - this.sectorElements.Add(this.first); - this.sectorElements.Add(this.second); - this.sectorElements.Add(this.third); - this.rule.Validate(sectorElements, this.args, this.loggerMock.Object); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); + rule.Validate(sectorElements, args, loggerMock.Object); - this.loggerMock.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + loggerMock.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItFailsOnNameClashTwoCircleSectorlines() { - this.sectorElements.Add(this.fourth); - this.sectorElements.Add(this.fifth); - this.sectorElements.Add(this.sixth); - this.rule.Validate(sectorElements, this.args, this.loggerMock.Object); + sectorElements.Add(fourth); + sectorElements.Add(fifth); + sectorElements.Add(sixth); + rule.Validate(sectorElements, args, loggerMock.Object); - this.loggerMock.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + loggerMock.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } [Fact] public void TestItFailsOnNameClashMixed() { - this.sectorElements.Add(this.second); - this.sectorElements.Add(this.third); - this.sectorElements.Add(this.fourth); - this.sectorElements.Add(this.fifth); - this.rule.Validate(sectorElements, this.args, this.loggerMock.Object); + sectorElements.Add(second); + sectorElements.Add(third); + sectorElements.Add(fourth); + sectorElements.Add(fifth); + rule.Validate(sectorElements, args, loggerMock.Object); - this.loggerMock.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + loggerMock.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } } } diff --git a/tests/CompilerTest/Validate/AllSectorlinesMustHaveValidDisplaySectorsTest.cs b/tests/CompilerTest/Validate/AllSectorlinesMustHaveValidDisplaySectorsTest.cs index 9a75711c..da0e629b 100644 --- a/tests/CompilerTest/Validate/AllSectorlinesMustHaveValidDisplaySectorsTest.cs +++ b/tests/CompilerTest/Validate/AllSectorlinesMustHaveValidDisplaySectorsTest.cs @@ -10,8 +10,8 @@ public class AllSectorlinesMustHaveValidDisplaySectorsTest: AbstractValidatorTes { public AllSectorlinesMustHaveValidDisplaySectorsTest() { - this.sectorElements.Add(SectorFactory.Make("COOL1")); - this.sectorElements.Add(SectorFactory.Make("COOL2")); + sectorElements.Add(SectorFactory.Make("COOL1")); + sectorElements.Add(SectorFactory.Make("COOL2")); } [Theory] @@ -20,7 +20,7 @@ public AllSectorlinesMustHaveValidDisplaySectorsTest() [InlineData("COOL1", "COOL1", "COOL2", "COOL2", "COOL2", "COOL1")] public void TestItPassesOnValidSector(string oneA, string twoA, string threeA, string oneB, string twoB, string threeB) { - this.sectorElements.Add( + sectorElements.Add( SectorlineFactory.Make( displayRules: new List { SectorLineDisplayRuleFactory.Make(oneA, twoA, threeA), @@ -28,7 +28,7 @@ public void TestItPassesOnValidSector(string oneA, string twoA, string threeA, s } ) ); - this.sectorElements.Add( + sectorElements.Add( SectorlineFactory.Make( displayRules: new List { SectorLineDisplayRuleFactory.Make(oneA, twoA, threeA), @@ -37,7 +37,7 @@ public void TestItPassesOnValidSector(string oneA, string twoA, string threeA, s ) ); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Theory] @@ -49,7 +49,7 @@ public void TestItPassesOnValidSector(string oneA, string twoA, string threeA, s [InlineData("COOL1", "COOL1", "COOL2", "COOL2", "COOL2", "NOTCOOL1")] public void TestItFailsOnInvalidSector(string oneA, string twoA, string threeA, string oneB, string twoB, string threeB) { - this.sectorElements.Add( + sectorElements.Add( SectorlineFactory.Make( displayRules: new List { SectorLineDisplayRuleFactory.Make(oneA, twoA, threeA), @@ -57,7 +57,7 @@ public void TestItFailsOnInvalidSector(string oneA, string twoA, string threeA, ) ); - this.sectorElements.Add( + sectorElements.Add( SectorlineFactory.Make( displayRules: new List { SectorLineDisplayRuleFactory.Make(oneB, twoB, threeB), @@ -65,7 +65,7 @@ public void TestItFailsOnInvalidSector(string oneA, string twoA, string threeA, ) ); - this.AssertValidationErrors(); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllSectorsMustHaveUniqueNameTest.cs b/tests/CompilerTest/Validate/AllSectorsMustHaveUniqueNameTest.cs index 44b3daff..dbc7dc88 100644 --- a/tests/CompilerTest/Validate/AllSectorsMustHaveUniqueNameTest.cs +++ b/tests/CompilerTest/Validate/AllSectorsMustHaveUniqueNameTest.cs @@ -15,30 +15,30 @@ public class AllSectorsMustHaveUniqueNameTest: AbstractValidatorTestCase public AllSectorsMustHaveUniqueNameTest() { - this.sectorElements = new SectorElementCollection(); - this.loggerMock = new Mock(); - this.first = SectorFactory.Make("ONE"); - this.second = SectorFactory.Make("ONE"); - this.third = SectorFactory.Make("NOTONE"); + sectorElements = new SectorElementCollection(); + loggerMock = new Mock(); + first = SectorFactory.Make("ONE"); + second = SectorFactory.Make("ONE"); + third = SectorFactory.Make("NOTONE"); } [Fact] public void TestItPassesIfAllNamesDifferent() { - this.sectorElements.Add(this.first); - this.sectorElements.Add(this.third); + sectorElements.Add(first); + sectorElements.Add(third); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnNameClash() { - this.sectorElements.Add(this.first); - this.sectorElements.Add(this.second); - this.sectorElements.Add(this.third); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); - this.AssertValidationErrors(); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllSectorsMustHaveValidActiveAirportTest.cs b/tests/CompilerTest/Validate/AllSectorsMustHaveValidActiveAirportTest.cs index 86ed038d..1d65b303 100644 --- a/tests/CompilerTest/Validate/AllSectorsMustHaveValidActiveAirportTest.cs +++ b/tests/CompilerTest/Validate/AllSectorsMustHaveValidActiveAirportTest.cs @@ -10,9 +10,9 @@ public class AllSectorsMustHaveValidActiveAirportTest: AbstractValidatorTestCase { public AllSectorsMustHaveValidActiveAirportTest() { - this.sectorElements.Add(AirportFactory.Make("EGKK")); - this.sectorElements.Add(AirportFactory.Make("EGLL")); - this.sectorElements.Add(AirportFactory.Make("EGCC")); + sectorElements.Add(AirportFactory.Make("EGKK")); + sectorElements.Add(AirportFactory.Make("EGLL")); + sectorElements.Add(AirportFactory.Make("EGCC")); } [Theory] @@ -22,18 +22,18 @@ public AllSectorsMustHaveValidActiveAirportTest() [InlineData("000A", "000A", "000A")] public void TestItPassesOnAllValid(string first, string second, string third) { - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - active: new List() + active: new List { SectorActiveFactory.Make(first), SectorActiveFactory.Make(third) } ) ); - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - active: new List() + active: new List { SectorActiveFactory.Make(second), SectorActiveFactory.Make(third) @@ -41,7 +41,7 @@ public void TestItPassesOnAllValid(string first, string second, string third) ) ); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Theory] @@ -52,18 +52,18 @@ public void TestItPassesOnAllValid(string first, string second, string third) [InlineData("000B", "000A", "000C", 2)] public void TestItFailsOnInvalid(string first, string second, string third, int timesCalled) { - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - active: new List() + active: new List { SectorActiveFactory.Make(first), SectorActiveFactory.Make(third) } ) ); - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - active: new List() + active: new List { SectorActiveFactory.Make(second), SectorActiveFactory.Make(third) @@ -71,7 +71,7 @@ public void TestItFailsOnInvalid(string first, string second, string third, int ) ); - this.AssertValidationErrors(timesCalled); + AssertValidationErrors(timesCalled); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllSectorsMustHaveValidActiveRunwayTest.cs b/tests/CompilerTest/Validate/AllSectorsMustHaveValidActiveRunwayTest.cs index cc1cf2c7..8f56ac42 100644 --- a/tests/CompilerTest/Validate/AllSectorsMustHaveValidActiveRunwayTest.cs +++ b/tests/CompilerTest/Validate/AllSectorsMustHaveValidActiveRunwayTest.cs @@ -10,13 +10,13 @@ public class AllSectorsMustHaveValidActiveRunwayTest: AbstractValidatorTestCase { public AllSectorsMustHaveValidActiveRunwayTest() { - this.sectorElements.Add(AirportFactory.Make("EGKK")); - this.sectorElements.Add(AirportFactory.Make("EGLL")); - this.sectorElements.Add(AirportFactory.Make("EGCC")); - this.sectorElements.Add(RunwayFactory.Make("EGKK", "26L", "09")); - this.sectorElements.Add(RunwayFactory.Make("EGLL", "27L", "09")); - this.sectorElements.Add(RunwayFactory.Make("EGLL", "27R", "09")); - this.sectorElements.Add(RunwayFactory.Make("EGCC", "23L", "09")); + sectorElements.Add(AirportFactory.Make("EGKK")); + sectorElements.Add(AirportFactory.Make("EGLL")); + sectorElements.Add(AirportFactory.Make("EGCC")); + sectorElements.Add(RunwayFactory.Make("EGKK", "26L", "09")); + sectorElements.Add(RunwayFactory.Make("EGLL", "27L", "09")); + sectorElements.Add(RunwayFactory.Make("EGLL", "27R", "09")); + sectorElements.Add(RunwayFactory.Make("EGCC", "23L", "09")); } [Theory] @@ -27,9 +27,9 @@ public AllSectorsMustHaveValidActiveRunwayTest() [InlineData("000A", "00", "000A", "01")] public void TestItPassesOnAllValid(string firstAirport, string firstRunway, string secondAirport, string secondRunway) { - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - active: new List() + active: new List { SectorActiveFactory.Make(firstAirport, firstRunway), SectorActiveFactory.Make(secondAirport, secondRunway), @@ -37,9 +37,9 @@ public void TestItPassesOnAllValid(string firstAirport, string firstRunway, stri ) ); - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - active: new List() + active: new List { SectorActiveFactory.Make(firstAirport, firstRunway), SectorActiveFactory.Make(secondAirport, secondRunway), @@ -47,7 +47,7 @@ public void TestItPassesOnAllValid(string firstAirport, string firstRunway, stri ) ); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Theory] @@ -58,9 +58,9 @@ public void TestItPassesOnAllValid(string firstAirport, string firstRunway, stri [InlineData("000B", "01", "000A", "04", 2)] public void TestItFailsOnInvalid (string firstAirport, string firstRunway, string secondAirport, string secondRunway, int failTimes) { - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - active: new List() + active: new List { SectorActiveFactory.Make(firstAirport, firstRunway), SectorActiveFactory.Make(secondAirport, secondRunway), @@ -68,9 +68,9 @@ public void TestItFailsOnInvalid (string firstAirport, string firstRunway, strin ) ); - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - active: new List() + active: new List { SectorActiveFactory.Make(firstAirport, firstRunway), SectorActiveFactory.Make(secondAirport, secondRunway), @@ -78,7 +78,7 @@ public void TestItFailsOnInvalid (string firstAirport, string firstRunway, strin ) ); - this.AssertValidationErrors(failTimes); + AssertValidationErrors(failTimes); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllSectorsMustHaveValidAltOwnerTest.cs b/tests/CompilerTest/Validate/AllSectorsMustHaveValidAltOwnerTest.cs index e21fbe47..678515ed 100644 --- a/tests/CompilerTest/Validate/AllSectorsMustHaveValidAltOwnerTest.cs +++ b/tests/CompilerTest/Validate/AllSectorsMustHaveValidAltOwnerTest.cs @@ -10,35 +10,35 @@ public class AllSectorsMustHaveValidAltOwnerTest: AbstractValidatorTestCase { public AllSectorsMustHaveValidAltOwnerTest() { - this.sectorElements.Add(ControllerPositionFactory.Make("BBR")); - this.sectorElements.Add(ControllerPositionFactory.Make("BBF")); - this.sectorElements.Add(ControllerPositionFactory.Make("LS")); - this.sectorElements.Add(ControllerPositionFactory.Make("LC")); + sectorElements.Add(ControllerPositionFactory.Make("BBR")); + sectorElements.Add(ControllerPositionFactory.Make("BBF")); + sectorElements.Add(ControllerPositionFactory.Make("LS")); + sectorElements.Add(ControllerPositionFactory.Make("LC")); } [Fact] public void TestItPassesOnValidControllers() { - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - alternate: new List() + alternate: new List { - SectorAlternateOwnerHierarchyFactory.Make(new List(){"LS", "LC"}), - SectorAlternateOwnerHierarchyFactory.Make(new List(){"BBR"}), + SectorAlternateOwnerHierarchyFactory.Make(new List {"LS", "LC"}), + SectorAlternateOwnerHierarchyFactory.Make(new List {"BBR"}), } ) ); - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - alternate: new List() + alternate: new List { - SectorAlternateOwnerHierarchyFactory.Make(new List(){"LS", "LC"}), - SectorAlternateOwnerHierarchyFactory.Make(new List(){"BBR", "LS"}), + SectorAlternateOwnerHierarchyFactory.Make(new List {"LS", "LC"}), + SectorAlternateOwnerHierarchyFactory.Make(new List {"BBR", "LS"}), } ) ); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Theory] @@ -47,27 +47,27 @@ public void TestItPassesOnValidControllers() [InlineData("LS","LC", "WHAT", "WHAT")] public void TestItFailsOnInvalidControllers(string first, string second, string third, string bad) { - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - alternate: new List() + alternate: new List { - SectorAlternateOwnerHierarchyFactory.Make(new List(){first, second}), - SectorAlternateOwnerHierarchyFactory.Make(new List(){second}), + SectorAlternateOwnerHierarchyFactory.Make(new List {first, second}), + SectorAlternateOwnerHierarchyFactory.Make(new List {second}), } ) ); - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - alternate: new List() + alternate: new List { - SectorAlternateOwnerHierarchyFactory.Make(new List(){first, second}), - SectorAlternateOwnerHierarchyFactory.Make(new List(){second, third, bad, first}), + SectorAlternateOwnerHierarchyFactory.Make(new List {first, second}), + SectorAlternateOwnerHierarchyFactory.Make(new List {second, third, bad, first}), } ) ); - this.AssertValidationErrors(); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllSectorsMustHaveValidArrivalAirportsTest.cs b/tests/CompilerTest/Validate/AllSectorsMustHaveValidArrivalAirportsTest.cs index 4c41adbc..9b2160e0 100644 --- a/tests/CompilerTest/Validate/AllSectorsMustHaveValidArrivalAirportsTest.cs +++ b/tests/CompilerTest/Validate/AllSectorsMustHaveValidArrivalAirportsTest.cs @@ -10,9 +10,9 @@ public class AllSectorsMustHaveValidArrivalAirportsTest: AbstractValidatorTestCa { public AllSectorsMustHaveValidArrivalAirportsTest() { - this.sectorElements.Add(AirportFactory.Make("EGKK")); - this.sectorElements.Add(AirportFactory.Make("EGLL")); - this.sectorElements.Add(AirportFactory.Make("EGCC")); + sectorElements.Add(AirportFactory.Make("EGKK")); + sectorElements.Add(AirportFactory.Make("EGLL")); + sectorElements.Add(AirportFactory.Make("EGCC")); } [Theory] @@ -22,24 +22,24 @@ public AllSectorsMustHaveValidArrivalAirportsTest() [InlineData("EGKK", "EGLL", "EGCC")] public void TestItPassesOnAllValid(string first, string second, string third) { - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - arrivalAirports: new List() + arrivalAirports: new List { - SectorArrivalAirportsFactory.Make(new List(){first, second}) + SectorArrivalAirportsFactory.Make(new List {first, second}) } ) ); - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - arrivalAirports: new List() + arrivalAirports: new List { - SectorArrivalAirportsFactory.Make(new List(){second, third}) + SectorArrivalAirportsFactory.Make(new List {second, third}) } ) ); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Theory] @@ -50,24 +50,24 @@ public void TestItPassesOnAllValid(string first, string second, string third) [InlineData("WHAT", "WHAT", "WHAT", 2)] public void TestItFailsOnInvalid(string first, string second, string third, int timesCalled) { - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - arrivalAirports: new List() + arrivalAirports: new List { - SectorArrivalAirportsFactory.Make(new List(){first, second}) + SectorArrivalAirportsFactory.Make(new List {first, second}) } ) ); - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - arrivalAirports: new List() + arrivalAirports: new List { - SectorArrivalAirportsFactory.Make(new List(){second, third}) + SectorArrivalAirportsFactory.Make(new List {second, third}) } ) ); - this.AssertValidationErrors(timesCalled); + AssertValidationErrors(timesCalled); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllSectorsMustHaveValidBorderTest.cs b/tests/CompilerTest/Validate/AllSectorsMustHaveValidBorderTest.cs index 57eae37e..7a9c234a 100644 --- a/tests/CompilerTest/Validate/AllSectorsMustHaveValidBorderTest.cs +++ b/tests/CompilerTest/Validate/AllSectorsMustHaveValidBorderTest.cs @@ -19,20 +19,20 @@ public class AllSectorsMustHaveValidBorderTest public AllSectorsMustHaveValidBorderTest() { - this.sectorElements = new SectorElementCollection(); - this.loggerMock = new Mock(); - this.rule = new AllSectorsMustHaveValidBorder(); - this.args = new CompilerArguments(); + sectorElements = new SectorElementCollection(); + loggerMock = new Mock(); + rule = new AllSectorsMustHaveValidBorder(); + args = new CompilerArguments(); - this.sectorElements.Add(SectorlineFactory.Make("ONE")); - this.sectorElements.Add(SectorlineFactory.Make("TWO")); - this.sectorElements.Add(CircleSectorlineFactory.Make("THREE")); + sectorElements.Add(SectorlineFactory.Make("ONE")); + sectorElements.Add(SectorlineFactory.Make("TWO")); + sectorElements.Add(CircleSectorlineFactory.Make("THREE")); } [Fact] public void TestItPassesOnValidBorders() { - this.sectorElements.Add( + sectorElements.Add( new Sector( "COOL1", 5000, @@ -41,9 +41,10 @@ public void TestItPassesOnValidBorders() SectorAlternateOwnerHierarchyFactory.MakeList(2), SectorActiveFactory.MakeList(), SectorGuestFactory.MakeList(), - new List() { + new List + { new( - new List() + new List { "ONE", "TWO", @@ -61,7 +62,7 @@ public void TestItPassesOnValidBorders() ) ); - this.sectorElements.Add( + sectorElements.Add( new Sector( "COOL2", 5000, @@ -70,9 +71,10 @@ public void TestItPassesOnValidBorders() SectorAlternateOwnerHierarchyFactory.MakeList(2), SectorActiveFactory.MakeList(), SectorGuestFactory.MakeList(), - new List() { + new List + { new( - new List() + new List { "ONE", "THREE", @@ -90,8 +92,8 @@ public void TestItPassesOnValidBorders() ) ); - this.rule.Validate(sectorElements, this.args, this.loggerMock.Object); - this.loggerMock.Verify(foo => foo.AddEvent(It.IsAny()), Times.Never); + rule.Validate(sectorElements, args, loggerMock.Object); + loggerMock.Verify(foo => foo.AddEvent(It.IsAny()), Times.Never); } [Theory] @@ -100,7 +102,7 @@ public void TestItPassesOnValidBorders() [InlineData("THREE", "TWO", "FOUR")] public void TestItFailsOnInvalidBorder(string first, string second, string bad) { - this.sectorElements.Add( + sectorElements.Add( new Sector( "COOL1", 5000, @@ -109,9 +111,10 @@ public void TestItFailsOnInvalidBorder(string first, string second, string bad) SectorAlternateOwnerHierarchyFactory.MakeList(2), SectorActiveFactory.MakeList(), SectorGuestFactory.MakeList(), - new List() { + new List + { new( - new List() + new List { first, second, @@ -129,7 +132,7 @@ public void TestItFailsOnInvalidBorder(string first, string second, string bad) ) ); - this.sectorElements.Add( + sectorElements.Add( new Sector( "COOL2", 5000, @@ -138,9 +141,10 @@ public void TestItFailsOnInvalidBorder(string first, string second, string bad) SectorAlternateOwnerHierarchyFactory.MakeList(2), SectorActiveFactory.MakeList(), SectorGuestFactory.MakeList(), - new List() { + new List + { new( - new List() + new List { first, second, @@ -159,8 +163,8 @@ public void TestItFailsOnInvalidBorder(string first, string second, string bad) ) ); - this.rule.Validate(sectorElements, this.args, this.loggerMock.Object); - this.loggerMock.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); + rule.Validate(sectorElements, args, loggerMock.Object); + loggerMock.Verify(foo => foo.AddEvent(It.IsAny()), Times.Once); } } } diff --git a/tests/CompilerTest/Validate/AllSectorsMustHaveValidDepartureAirportsTest.cs b/tests/CompilerTest/Validate/AllSectorsMustHaveValidDepartureAirportsTest.cs index e53b444e..74632b29 100644 --- a/tests/CompilerTest/Validate/AllSectorsMustHaveValidDepartureAirportsTest.cs +++ b/tests/CompilerTest/Validate/AllSectorsMustHaveValidDepartureAirportsTest.cs @@ -10,9 +10,9 @@ public class AllSectorsMustHaveValidDepartureAirportsTest: AbstractValidatorTest { public AllSectorsMustHaveValidDepartureAirportsTest() { - this.sectorElements.Add(AirportFactory.Make("EGKK")); - this.sectorElements.Add(AirportFactory.Make("EGLL")); - this.sectorElements.Add(AirportFactory.Make("EGCC")); + sectorElements.Add(AirportFactory.Make("EGKK")); + sectorElements.Add(AirportFactory.Make("EGLL")); + sectorElements.Add(AirportFactory.Make("EGCC")); } [Theory] @@ -22,24 +22,24 @@ public AllSectorsMustHaveValidDepartureAirportsTest() [InlineData("EGKK", "EGLL", "EGCC")] public void TestItPassesOnAllValid(string first, string second, string third) { - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - departureAirports: new List() + departureAirports: new List { - SectorDepartureAirportsFactory.Make(new List() {first, second}) + SectorDepartureAirportsFactory.Make(new List {first, second}) } ) ); - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - departureAirports: new List() + departureAirports: new List { - SectorDepartureAirportsFactory.Make(new List() {second, third}) + SectorDepartureAirportsFactory.Make(new List {second, third}) } ) ); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Theory] @@ -50,24 +50,24 @@ public void TestItPassesOnAllValid(string first, string second, string third) [InlineData("WHAT", "WHAT", "WHAT", 2)] public void TestItFailsOnInvalid(string first, string second, string third, int timesCalled) { - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - departureAirports: new List() + departureAirports: new List { - SectorDepartureAirportsFactory.Make(new List() {first, second}) + SectorDepartureAirportsFactory.Make(new List {first, second}) } ) ); - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - departureAirports: new List() + departureAirports: new List { - SectorDepartureAirportsFactory.Make(new List() {second, third}) + SectorDepartureAirportsFactory.Make(new List {second, third}) } ) ); - this.AssertValidationErrors(timesCalled); + AssertValidationErrors(timesCalled); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllSectorsMustHaveValidGuestAirportsTest.cs b/tests/CompilerTest/Validate/AllSectorsMustHaveValidGuestAirportsTest.cs index 2bae2b3a..4e2231c8 100644 --- a/tests/CompilerTest/Validate/AllSectorsMustHaveValidGuestAirportsTest.cs +++ b/tests/CompilerTest/Validate/AllSectorsMustHaveValidGuestAirportsTest.cs @@ -10,9 +10,9 @@ public class AllSectorsMustHaveValidGuestAirportsTest: AbstractValidatorTestCase { public AllSectorsMustHaveValidGuestAirportsTest() { - this.sectorElements.Add(AirportFactory.Make("EGKK")); - this.sectorElements.Add(AirportFactory.Make("EGLL")); - this.sectorElements.Add(AirportFactory.Make("EGCC")); + sectorElements.Add(AirportFactory.Make("EGKK")); + sectorElements.Add(AirportFactory.Make("EGLL")); + sectorElements.Add(AirportFactory.Make("EGCC")); } [Theory] @@ -22,18 +22,18 @@ public AllSectorsMustHaveValidGuestAirportsTest() [InlineData("EGKK", "EGLL", "EGCC")] public void TestItPassesOnAllValid(string first, string second, string third) { - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - guests: new List() + guests: new List { SectorGuestFactory.Make(firstAirport: first, secondAirport: second), SectorGuestFactory.Make(firstAirport: third, secondAirport: "*"), } ) ); - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - guests: new List() + guests: new List { SectorGuestFactory.Make(firstAirport: third, secondAirport: first), SectorGuestFactory.Make(firstAirport: "*", secondAirport: "*"), @@ -41,7 +41,7 @@ public void TestItPassesOnAllValid(string first, string second, string third) ) ); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Theory] @@ -52,18 +52,18 @@ public void TestItPassesOnAllValid(string first, string second, string third) [InlineData("WHAT", "WHAT", "WHAT", 2)] public void TestItFailsOnInvalid(string first, string second, string third, int timesCalled) { - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - guests: new List() + guests: new List { SectorGuestFactory.Make(firstAirport: first, secondAirport: second), SectorGuestFactory.Make(firstAirport: third, secondAirport: "*"), } ) ); - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - guests: new List() + guests: new List { SectorGuestFactory.Make(firstAirport: third, secondAirport: first), SectorGuestFactory.Make(firstAirport: "*", secondAirport: "*"), @@ -71,7 +71,7 @@ public void TestItFailsOnInvalid(string first, string second, string third, int ) ); - this.AssertValidationErrors(timesCalled); + AssertValidationErrors(timesCalled); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllSectorsMustHaveValidGuestControllerTest.cs b/tests/CompilerTest/Validate/AllSectorsMustHaveValidGuestControllerTest.cs index 7616a1e7..d01763c6 100644 --- a/tests/CompilerTest/Validate/AllSectorsMustHaveValidGuestControllerTest.cs +++ b/tests/CompilerTest/Validate/AllSectorsMustHaveValidGuestControllerTest.cs @@ -10,10 +10,10 @@ public class AllSectorsMustHaveValidGuestControllerTest: AbstractValidatorTestCa { public AllSectorsMustHaveValidGuestControllerTest() { - this.sectorElements.Add(ControllerPositionFactory.Make("BBR")); - this.sectorElements.Add(ControllerPositionFactory.Make("BBF")); - this.sectorElements.Add(ControllerPositionFactory.Make("LS")); - this.sectorElements.Add(ControllerPositionFactory.Make("LC")); + sectorElements.Add(ControllerPositionFactory.Make("BBR")); + sectorElements.Add(ControllerPositionFactory.Make("BBF")); + sectorElements.Add(ControllerPositionFactory.Make("LS")); + sectorElements.Add(ControllerPositionFactory.Make("LC")); } [Theory] @@ -22,18 +22,18 @@ public AllSectorsMustHaveValidGuestControllerTest() [InlineData("BBR", "BBR", "BBR")] public void TestItPassesOnValidControllers(string first, string second, string third) { - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - guests: new List() + guests: new List { SectorGuestFactory.Make(first), SectorGuestFactory.Make(third), } ) ); - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - guests: new List() + guests: new List { SectorGuestFactory.Make(second), SectorGuestFactory.Make(third), @@ -41,7 +41,7 @@ public void TestItPassesOnValidControllers(string first, string second, string t ) ); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Theory] @@ -52,18 +52,18 @@ public void TestItPassesOnValidControllers(string first, string second, string t [InlineData("NOPE", "NOPE", "LS", 2)] public void TestItFailsOnInvalidControllers(string first, string second, string third, int numErrors) { - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - guests: new List() + guests: new List { SectorGuestFactory.Make(first), SectorGuestFactory.Make(third), } ) ); - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - guests: new List() + guests: new List { SectorGuestFactory.Make(second), SectorGuestFactory.Make(third), @@ -71,7 +71,7 @@ public void TestItFailsOnInvalidControllers(string first, string second, string ) ); - this.AssertValidationErrors(numErrors); + AssertValidationErrors(numErrors); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllSectorsMustHaveValidOwnerTest.cs b/tests/CompilerTest/Validate/AllSectorsMustHaveValidOwnerTest.cs index 26c1bd78..a80eccc0 100644 --- a/tests/CompilerTest/Validate/AllSectorsMustHaveValidOwnerTest.cs +++ b/tests/CompilerTest/Validate/AllSectorsMustHaveValidOwnerTest.cs @@ -9,27 +9,27 @@ public class AllSectorsMustHaveValidOwnerTest: AbstractValidatorTestCase { public AllSectorsMustHaveValidOwnerTest() { - this.sectorElements.Add(ControllerPositionFactory.Make("BBR")); - this.sectorElements.Add(ControllerPositionFactory.Make("BBF")); - this.sectorElements.Add(ControllerPositionFactory.Make("LS")); - this.sectorElements.Add(ControllerPositionFactory.Make("LC")); + sectorElements.Add(ControllerPositionFactory.Make("BBR")); + sectorElements.Add(ControllerPositionFactory.Make("BBF")); + sectorElements.Add(ControllerPositionFactory.Make("LS")); + sectorElements.Add(ControllerPositionFactory.Make("LC")); } [Fact] public void TestItPassesOnValidControllers() { - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - owners: SectorOwnerHierarchyFactory.Make(new List(){"LS", "LC"}) + owners: SectorOwnerHierarchyFactory.Make(new List {"LS", "LC"}) ) ); - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - owners: SectorOwnerHierarchyFactory.Make(new List(){"LS", "LC", "BBR", "BBF"}) + owners: SectorOwnerHierarchyFactory.Make(new List {"LS", "LC", "BBR", "BBF"}) ) ); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Theory] @@ -39,18 +39,18 @@ public void TestItPassesOnValidControllers() [InlineData("BBF","WHAT")] public void TestItFailsOnInvalidControllers(string first, string second) { - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - owners: SectorOwnerHierarchyFactory.Make(new List(){first}) + owners: SectorOwnerHierarchyFactory.Make(new List {first}) ) ); - this.sectorElements.Add( + sectorElements.Add( SectorFactory.Make( - owners: SectorOwnerHierarchyFactory.Make(new List(){first, second}) + owners: SectorOwnerHierarchyFactory.Make(new List {first, second}) ) ); - this.AssertValidationErrors(); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllSidsMustBeUniqueTest.cs b/tests/CompilerTest/Validate/AllSidsMustBeUniqueTest.cs index c083b11e..8ef069cd 100644 --- a/tests/CompilerTest/Validate/AllSidsMustBeUniqueTest.cs +++ b/tests/CompilerTest/Validate/AllSidsMustBeUniqueTest.cs @@ -15,35 +15,35 @@ public class AllSidsMustBeUniqueTest: AbstractValidatorTestCase public AllSidsMustBeUniqueTest() { - this.first = SidStarFactory.Make(true, "EGKK", "26L", "ADMAG2X", new List()); - this.second = SidStarFactory.Make(false, "EGKK", "26L", "ADMAG2X", new List()); - this.third = SidStarFactory.Make(true, "EGKK", "26L", "ADMAG2X", new List()); - this.fourth = SidStarFactory.Make(true, "EGKK", "26L", "ADMAG2X", new List() {"a"}); + first = SidStarFactory.Make(true, "EGKK", "26L", "ADMAG2X", new List()); + second = SidStarFactory.Make(false, "EGKK", "26L", "ADMAG2X", new List()); + third = SidStarFactory.Make(true, "EGKK", "26L", "ADMAG2X", new List()); + fourth = SidStarFactory.Make(true, "EGKK", "26L", "ADMAG2X", new List {"a"}); } [Fact] public void TestItPassesIfNoDuplicates() { - this.sectorElements.Add(this.first); - this.sectorElements.Add(this.second); - this.AssertNoValidationErrors(); + sectorElements.Add(first); + sectorElements.Add(second); + AssertNoValidationErrors(); } [Fact] public void TestItPassesOnDifferentRoutes() { - this.sectorElements.Add(this.first); - this.sectorElements.Add(this.fourth); - this.AssertNoValidationErrors(); + sectorElements.Add(first); + sectorElements.Add(fourth); + AssertNoValidationErrors(); } [Fact] public void TestItFailsIfThereAreDuplicates() { - this.sectorElements.Add(this.first); - this.sectorElements.Add(this.second); - this.sectorElements.Add(this.third); - this.AssertValidationErrors(); + sectorElements.Add(first); + sectorElements.Add(second); + sectorElements.Add(third); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllSidsMustHaveAValidAirportTest.cs b/tests/CompilerTest/Validate/AllSidsMustHaveAValidAirportTest.cs index 6fbe4a8e..16802349 100644 --- a/tests/CompilerTest/Validate/AllSidsMustHaveAValidAirportTest.cs +++ b/tests/CompilerTest/Validate/AllSidsMustHaveAValidAirportTest.cs @@ -13,32 +13,32 @@ public class AllSidsMustHaveAValidAirportTest: AbstractValidatorTestCase public AllSidsMustHaveAValidAirportTest() { - this.sid1 = SidStarFactory.Make(airport: "EGKK"); - this.sid2 = SidStarFactory.Make(airport: "EGCC"); - this.sid3 = SidStarFactory.Make(airport: "EGBB"); + sid1 = SidStarFactory.Make(airport: "EGKK"); + sid2 = SidStarFactory.Make(airport: "EGCC"); + sid3 = SidStarFactory.Make(airport: "EGBB"); - this.sectorElements.Add(AirportFactory.Make("EGKK")); - this.sectorElements.Add(AirportFactory.Make("EGLL")); - this.sectorElements.Add(AirportFactory.Make("EGCC")); + sectorElements.Add(AirportFactory.Make("EGKK")); + sectorElements.Add(AirportFactory.Make("EGLL")); + sectorElements.Add(AirportFactory.Make("EGCC")); } [Fact] public void TestItPassesOnAllValid() { - this.sectorElements.Add(sid1); - this.sectorElements.Add(sid2); + sectorElements.Add(sid1); + sectorElements.Add(sid2); - this.AssertNoValidationErrors(); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnInvalidAirport() { - this.sectorElements.Add(sid1); - this.sectorElements.Add(sid2); - this.sectorElements.Add(sid3); + sectorElements.Add(sid1); + sectorElements.Add(sid2); + sectorElements.Add(sid3); - this.AssertValidationErrors(); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/AllSidsMustHaveAValidRouteTest.cs b/tests/CompilerTest/Validate/AllSidsMustHaveAValidRouteTest.cs index 91d7f04f..d1419b6c 100644 --- a/tests/CompilerTest/Validate/AllSidsMustHaveAValidRouteTest.cs +++ b/tests/CompilerTest/Validate/AllSidsMustHaveAValidRouteTest.cs @@ -13,27 +13,27 @@ public class AllSidsMustHaveAValidRouteTest: AbstractValidatorTestCase public AllSidsMustHaveAValidRouteTest() { - this.first = SidStarFactory.Make(route: new List(new[] { "testfix", "testvor", "testndb", "testairport" })); - this.second = SidStarFactory.Make(route: new List(new[] { "nottestfix", "testvor", "testndb", "testairport" })); + first = SidStarFactory.Make(route: new List(new[] { "testfix", "testvor", "testndb", "testairport" })); + second = SidStarFactory.Make(route: new List(new[] { "nottestfix", "testvor", "testndb", "testairport" })); - this.sectorElements.Add(FixFactory.Make("testfix")); - this.sectorElements.Add(VorFactory.Make("testvor")); - this.sectorElements.Add(NdbFactory.Make("testndb")); - this.sectorElements.Add(AirportFactory.Make("testairport")); + sectorElements.Add(FixFactory.Make("testfix")); + sectorElements.Add(VorFactory.Make("testvor")); + sectorElements.Add(NdbFactory.Make("testndb")); + sectorElements.Add(AirportFactory.Make("testairport")); } [Fact] public void TestItPassesOnValidRoute() { - this.sectorElements.Add(this.first); - this.AssertNoValidationErrors(); + sectorElements.Add(first); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnInvalidRoute() { - this.sectorElements.Add(this.second); - this.AssertValidationErrors(); + sectorElements.Add(second); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/ColourValidatorTest.cs b/tests/CompilerTest/Validate/ColourValidatorTest.cs index 6a9fdd41..351637aa 100644 --- a/tests/CompilerTest/Validate/ColourValidatorTest.cs +++ b/tests/CompilerTest/Validate/ColourValidatorTest.cs @@ -11,9 +11,9 @@ public class ColourValidatorTest public ColourValidatorTest() { - this.sectorElements = new SectorElementCollection(); - this.sectorElements.Add(ColourFactory.Make("colour1")); - this.sectorElements.Add(ColourFactory.Make("colour2")); + sectorElements = new SectorElementCollection(); + sectorElements.Add(ColourFactory.Make("colour1")); + sectorElements.Add(ColourFactory.Make("colour2")); } [Theory] @@ -44,7 +44,7 @@ public void TestItFailsOnInvalidColourIntegers(string value) [InlineData("colour2")] public void TestItPassesIfColourIsDefined(string colour) { - Assert.True(ColourValidator.ColourIsDefined(this.sectorElements, colour)); + Assert.True(ColourValidator.ColourIsDefined(sectorElements, colour)); } [Theory] @@ -53,7 +53,7 @@ public void TestItPassesIfColourIsDefined(string colour) [InlineData("colour2")] public void TestItValidatesColour(string colour) { - Assert.True(ColourValidator.ColourValid(this.sectorElements, colour)); + Assert.True(ColourValidator.ColourValid(sectorElements, colour)); } [Theory] @@ -62,7 +62,7 @@ public void TestItValidatesColour(string colour) [InlineData("-1")] public void TestItFailsToValidateColour(string colour) { - Assert.False(ColourValidator.ColourValid(this.sectorElements, colour)); + Assert.False(ColourValidator.ColourValid(sectorElements, colour)); } } } \ No newline at end of file diff --git a/tests/CompilerTest/Validate/InfoMustHaveValidAirportTest.cs b/tests/CompilerTest/Validate/InfoMustHaveValidAirportTest.cs index 0a6d2f47..0c634699 100644 --- a/tests/CompilerTest/Validate/InfoMustHaveValidAirportTest.cs +++ b/tests/CompilerTest/Validate/InfoMustHaveValidAirportTest.cs @@ -8,22 +8,22 @@ public class InfoMustHaveValidAirportTest: AbstractValidatorTestCase { public InfoMustHaveValidAirportTest() { - this.sectorElements.Add(AirportFactory.Make("EGLL")); - this.sectorElements.Add(AirportFactory.Make("EGKK")); + sectorElements.Add(AirportFactory.Make("EGLL")); + sectorElements.Add(AirportFactory.Make("EGKK")); } [Fact] public void TestItPassesOnValidAirport() { - this.sectorElements.Add(InfoFactory.Make("EGLL")); - this.AssertNoValidationErrors(); + sectorElements.Add(InfoFactory.Make("EGLL")); + AssertNoValidationErrors(); } [Fact] public void TestItFailsOnInvalidAirport() { - this.sectorElements.Add(InfoFactory.Make("EGXX")); - this.AssertValidationErrors(); + sectorElements.Add(InfoFactory.Make("EGXX")); + AssertValidationErrors(); } protected override IValidationRule GetValidationRule() diff --git a/tests/CompilerTest/Validate/RoutePointValidatorTest.cs b/tests/CompilerTest/Validate/RoutePointValidatorTest.cs index 76d255a0..3b4b6e46 100644 --- a/tests/CompilerTest/Validate/RoutePointValidatorTest.cs +++ b/tests/CompilerTest/Validate/RoutePointValidatorTest.cs @@ -11,11 +11,11 @@ public class RoutePointValidatorTest public RoutePointValidatorTest() { - this.sectorElements = new SectorElementCollection(); - this.sectorElements.Add(FixFactory.Make("testfix")); - this.sectorElements.Add(VorFactory.Make("testvor")); - this.sectorElements.Add(NdbFactory.Make("testndb")); - this.sectorElements.Add(AirportFactory.Make("testairport")); + sectorElements = new SectorElementCollection(); + sectorElements.Add(FixFactory.Make("testfix")); + sectorElements.Add(VorFactory.Make("testvor")); + sectorElements.Add(NdbFactory.Make("testndb")); + sectorElements.Add(AirportFactory.Make("testairport")); } [Fact] @@ -37,7 +37,7 @@ public void TestItReturnsFalseOnInvalidCoordinate() [InlineData("nottestvor", false)] public void TestItChecksVors(string identifier, bool expected) { - Assert.Equal(expected, RoutePointValidator.IsValidVor(identifier, this.sectorElements)); + Assert.Equal(expected, RoutePointValidator.IsValidVor(identifier, sectorElements)); } [Theory] @@ -45,7 +45,7 @@ public void TestItChecksVors(string identifier, bool expected) [InlineData("nottestndb", false)] public void TestItChecksNdbs(string identifier, bool expected) { - Assert.Equal(expected, RoutePointValidator.IsValidNdb(identifier, this.sectorElements)); + Assert.Equal(expected, RoutePointValidator.IsValidNdb(identifier, sectorElements)); } [Theory] @@ -53,7 +53,7 @@ public void TestItChecksNdbs(string identifier, bool expected) [InlineData("nottestfix", false)] public void TestItChecksFixes(string identifier, bool expected) { - Assert.Equal(expected, RoutePointValidator.IsValidFix(identifier, this.sectorElements)); + Assert.Equal(expected, RoutePointValidator.IsValidFix(identifier, sectorElements)); } [Theory] @@ -61,79 +61,79 @@ public void TestItChecksFixes(string identifier, bool expected) [InlineData("nottestairport", false)] public void TestItChecksAirpots(string identifier, bool expected) { - Assert.Equal(expected, RoutePointValidator.IsValidAirport(identifier, this.sectorElements)); + Assert.Equal(expected, RoutePointValidator.IsValidAirport(identifier, sectorElements)); } [Fact] public void TestItValidatesFalseIfAllStepsFail() { Point point = new("what"); - Assert.False(RoutePointValidator.ValidatePoint(point, this.sectorElements)); + Assert.False(RoutePointValidator.ValidatePoint(point, sectorElements)); } [Fact] public void TestItValidatesTrueIfValidCoordinate() { Point point = new(new Coordinate("abc", "def")); - Assert.True(RoutePointValidator.ValidatePoint(point, this.sectorElements)); + Assert.True(RoutePointValidator.ValidatePoint(point, sectorElements)); } [Fact] public void TestItValidatesTrueIfValidVor() { Point point = new("testvor"); - Assert.True(RoutePointValidator.ValidatePoint(point, this.sectorElements)); + Assert.True(RoutePointValidator.ValidatePoint(point, sectorElements)); } [Fact] public void TestItValidatesTrueIfValidNdb() { Point point = new("testndb"); - Assert.True(RoutePointValidator.ValidatePoint(point, this.sectorElements)); + Assert.True(RoutePointValidator.ValidatePoint(point, sectorElements)); } [Fact] public void TestItValidatesTrueIfValidFix() { Point point = new("testfix"); - Assert.True(RoutePointValidator.ValidatePoint(point, this.sectorElements)); + Assert.True(RoutePointValidator.ValidatePoint(point, sectorElements)); } [Fact] public void TestItValidatesTrueIfValidAirport() { Point point = new("testairport"); - Assert.True(RoutePointValidator.ValidatePoint(point, this.sectorElements)); + Assert.True(RoutePointValidator.ValidatePoint(point, sectorElements)); } [Fact] public void TestItValidatesEseFalseIfAllStepsFail() { - Assert.False(RoutePointValidator.ValidateEseSidStarPoint("what", this.sectorElements)); + Assert.False(RoutePointValidator.ValidateEseSidStarPoint("what", sectorElements)); } [Fact] public void TestItValidatesEseTrueIfValidVor() { - Assert.True(RoutePointValidator.ValidateEseSidStarPoint("testvor", this.sectorElements)); + Assert.True(RoutePointValidator.ValidateEseSidStarPoint("testvor", sectorElements)); } [Fact] public void TestItValidatesEseTrueIfValidNdb() { - Assert.True(RoutePointValidator.ValidateEseSidStarPoint("testndb", this.sectorElements)); + Assert.True(RoutePointValidator.ValidateEseSidStarPoint("testndb", sectorElements)); } [Fact] public void TestItValidatesEseTrueIfValidFix() { - Assert.True(RoutePointValidator.ValidateEseSidStarPoint("testfix", this.sectorElements)); + Assert.True(RoutePointValidator.ValidateEseSidStarPoint("testfix", sectorElements)); } [Fact] public void TestItValidatesEseTrueIfValidAirport() { - Assert.True(RoutePointValidator.ValidateEseSidStarPoint("testairport", this.sectorElements)); + Assert.True(RoutePointValidator.ValidateEseSidStarPoint("testairport", sectorElements)); } } }