-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sids): validate the runways used on sids and stars (#148)
Used to use just airfield, now do both.
- Loading branch information
Showing
4 changed files
with
61 additions
and
61 deletions.
There are no files selected for viewing
14 changes: 4 additions & 10 deletions
14
.../Validate/AllSidsMustHaveAValidAirport.cs → ...r/Validate/AllSidsMustHaveAValidRunway.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 0 additions & 49 deletions
49
tests/CompilerTest/Validate/AllSidsMustHaveAValidAirportTest.cs
This file was deleted.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
tests/CompilerTest/Validate/AllSidsMustHaveAValidRunwayTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using Xunit; | ||
using Compiler.Model; | ||
using Compiler.Validate; | ||
using CompilerTest.Bogus.Factory; | ||
|
||
namespace CompilerTest.Validate | ||
{ | ||
public class AllSidsMustHaveAValidRunwayTest: AbstractValidatorTestCase | ||
{ | ||
private readonly SidStar sid1; | ||
private readonly SidStar sid2; | ||
private readonly SidStar sid3; | ||
private readonly SidStar sid4; | ||
|
||
public AllSidsMustHaveAValidRunwayTest() | ||
{ | ||
sid1 = SidStarFactory.Make(airport: "EGKK", runway: "26L"); | ||
sid2 = SidStarFactory.Make(airport: "EGCC", runway: "23R"); | ||
sid3 = SidStarFactory.Make(airport: "EGBB", runway: "16"); | ||
sid4 = SidStarFactory.Make(airport: "EGKB", runway: "08"); | ||
|
||
sectorElements.Add(AirportFactory.Make("EGKK")); | ||
sectorElements.Add(AirportFactory.Make("EGCC")); | ||
sectorElements.Add(AirportFactory.Make("EGBB")); | ||
sectorElements.Add(RunwayFactory.Make("EGKK", "26L", "08R")); | ||
sectorElements.Add(RunwayFactory.Make("EGCC", "23R", "05L")); | ||
sectorElements.Add(RunwayFactory.Make("EGBB", "33", "15")); | ||
} | ||
|
||
[Fact] | ||
public void TestItPassesOnAllValid() | ||
{ | ||
sectorElements.Add(sid1); | ||
sectorElements.Add(sid2); | ||
|
||
AssertNoValidationErrors(); | ||
} | ||
|
||
[Fact] | ||
public void TestItFailsOnInvalidAirport() | ||
{ | ||
sectorElements.Add(sid1); | ||
sectorElements.Add(sid2); | ||
sectorElements.Add(sid3); // Airport exists, not runway | ||
sectorElements.Add(sid4); // Airport doesn't exist | ||
|
||
AssertValidationErrors(2); | ||
} | ||
|
||
protected override IValidationRule GetValidationRule() | ||
{ | ||
return new AllSidsMustHaveAValidRunway(); | ||
} | ||
} | ||
} |