예제 #1
0
        public void TestItReturnsElementsInOrder()
        {
            ActiveRunway first  = ActiveRunwayFactory.Make("EGLL", "09L", 0);
            ActiveRunway second = ActiveRunwayFactory.Make("EGLL", "27L", 0);
            ActiveRunway third  = ActiveRunwayFactory.Make("EGLL", "09L", 1);
            ActiveRunway fourth = ActiveRunwayFactory.Make("EGLL", "09R", 0);
            ActiveRunway fifth  = ActiveRunwayFactory.Make("EGKK", "26L", 0);

            sectorElements.Add(first);
            sectorElements.Add(second);
            sectorElements.Add(third);
            sectorElements.Add(fourth);
            sectorElements.Add(fifth);

            IEnumerable <ICompilableElementProvider> expected = new List <ICompilableElementProvider>()
            {
                fifth,
                first,
                third,
                fourth,
                second
            };

            AssertCollectedItems(expected);
        }
        public void TestItAddsActiveRunways()
        {
            ActiveRunway runway = ActiveRunwayFactory.Make();

            collection.Add(runway);

            Assert.Equal(runway, collection.ActiveRunways[0]);
        }
예제 #3
0
 public ActiveRunwayTest()
 {
     this.activeRunway = new ActiveRunway(
         "33",
         "EGBB",
         1,
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
예제 #4
0
        public void TestItAddsDataInMode1()
        {
            RunParserOnLines(new List <string>(new[] { "ACTIVE_RUNWAY:EGHI:20:1 ;comment" }));

            ActiveRunway result = sectorElementCollection.ActiveRunways[0];

            Assert.Equal("EGHI", result.Airfield);
            Assert.Equal("20", result.Identifier);
            Assert.Equal(1, result.Mode);
            AssertExpectedMetadata(result);
        }
예제 #5
0
        public void Validate(SectorElementCollection sectorElements, CompilerArguments args, IEventLogger events)
        {
            var duplicates = sectorElements.ActiveRunways.GroupBy(
                runway => runway
                )
                             .Where(g => g.Count() > 1)
                             .ToList();

            if (!duplicates.Any())
            {
                return;
            }

            foreach (var duplicate in duplicates)
            {
                ActiveRunway runway = duplicate.First();
                events.AddEvent(
                    new ValidationRuleFailure(
                        $"Duplicate ACTIVE_RUNWAY {runway.Airfield}:{runway.Identifier}:{runway.Mode}",
                        runway
                        )
                    );
            }
        }
예제 #6
0
 private bool IsSameRunway(ActiveRunway activeRunway, Runway runway)
 {
     return(runway.AirfieldIcao == activeRunway.Airfield &&
            (runway.FirstIdentifier == activeRunway.Identifier ||
             runway.ReverseIdentifier == activeRunway.Identifier));
 }