public void TestItAddsSectorlines()
        {
            Sectorline sectorline = SectorlineFactory.Make();

            collection.Add(sectorline);
            Assert.Equal(sectorline, collection.SectorLines[0]);
        }
        public void TestItAddsMixedDataNoDisplayRules()
        {
            RunParserOnLines(
                new List <string>(new[] {
                "SECTORLINE:JJCTR - LS ;comment6",
                "COORD:N049.59.59.000:W002.29.35.000 ;comment9",
                "COORD:N050.00.00.000:W001.47.00.000 ;comment10",
                "",
                "CIRCLE_SECTORLINE:BBTWR:EGBB:2.5 ;comment",
            })
                );

            // First
            CircleSectorline result1 = sectorElementCollection.CircleSectorLines[0];

            Assert.Equal("BBTWR", result1.Name);
            Assert.Equal("EGBB", result1.CentrePoint);
            Assert.Equal(2.5, result1.Radius);
            Assert.Empty(result1.DisplayRules);


            // Second
            Sectorline result2 = sectorElementCollection.SectorLines[0];

            Assert.Equal("JJCTR - LS", result2.Name);
            Assert.Empty(result2.DisplayRules);
        }
Beispiel #3
0
 public AllSectorlineElementsMustHaveUniqueNameTest()
 {
     sectorElements = new SectorElementCollection();
     loggerMock     = new Mock <IEventLogger>();
     first          = new Sectorline(
         "ONE",
         SectorLineDisplayRuleFactory.MakeList(2),
         SectorlineCoordinateFactory.MakeList(2),
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
     second = new Sectorline(
         "ONE",
         SectorLineDisplayRuleFactory.MakeList(2),
         SectorlineCoordinateFactory.MakeList(2),
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
     third = new Sectorline(
         "NOTONE",
         SectorLineDisplayRuleFactory.MakeList(2),
         SectorlineCoordinateFactory.MakeList(2),
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
     fourth = new CircleSectorline(
         "ONE",
         "EGGD",
         5.5,
         SectorLineDisplayRuleFactory.MakeList(3),
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
     fifth = new CircleSectorline(
         "NOTONEORTWO",
         "EGGD",
         5.5,
         SectorLineDisplayRuleFactory.MakeList(),
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
     sixth = new CircleSectorline(
         "ONE",
         "EGGD",
         5.5,
         SectorLineDisplayRuleFactory.MakeList(2),
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
     rule = new AllSectorlineElementsMustHaveUniqueName();
     args = new CompilerArguments();
 }
 public SectorlineTest()
 {
     this.displayRules = SectorLineDisplayRuleFactory.MakeList();
     this.coordinates  = SectorlineCoordinateFactory.MakeList();
     this.model        = new Sectorline(
         "Test Sectorline",
         this.displayRules,
         this.coordinates,
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
        public void TestItReturnsElementsInOrder()
        {
            OutputGroup group1 = new("1");
            OutputGroup group2 = new("2");

            outputGroups.AddGroupWithFiles(group1, new List <string> {
                "foo.txt"
            });
            outputGroups.AddGroupWithFiles(group2, new List <string> {
                "goo.txt"
            });

            Sectorline       line1 = SectorlineFactory.Make(definition: DefinitionFactory.Make("foo.txt"));
            Sectorline       line2 = SectorlineFactory.Make(definition: DefinitionFactory.Make("goo.txt"));
            CircleSectorline line3 = CircleSectorlineFactory.Make(definition: DefinitionFactory.Make("foo.txt"));

            Sector sector1 = SectorFactory.Make(definition: DefinitionFactory.Make("goo.txt"));
            Sector sector2 = SectorFactory.Make(definition: DefinitionFactory.Make("foo.txt"));

            CoordinationPoint point1 = CoordinationPointFactory.Make(false, definition: DefinitionFactory.Make("foo.txt"));
            CoordinationPoint point2 = CoordinationPointFactory.Make(true, definition: DefinitionFactory.Make("foo.txt"));
            CoordinationPoint point3 = CoordinationPointFactory.Make(false, definition: DefinitionFactory.Make("goo.txt"));

            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 <ICompilableElementProvider> expected = new List <ICompilableElementProvider>()
            {
                line1,
                line3,
                line2,
                sector2,
                sector1,
                point1,
                point3,
                point2
            };

            AssertCollectedItems(expected);
        }
        public void TestItAddsMixedData()
        {
            RunParserOnLines(
                new List <string>(new[] {
                "SECTORLINE:JJCTR - LS ;comment6",
                "DISPLAY:London AC Worthing:JJCTR:JJCTR ;comment7",
                "DISPLAY:JJCTR:JJCTR:London AC Worthing ;comment8",
                "COORD:N049.59.59.000:W002.29.35.000 ;comment9",
                "COORD:N050.00.00.000:W001.47.00.000 ;comment10",
                "",
                "CIRCLE_SECTORLINE:BBTWR:EGBB:2.5 ;comment",
                "DISPLAY:BBAPP:BBAPP:BBTWR ;comment1",
                "DISPLAY:BBTWR:BBAPP:BBTWR ;comment2",
            })
                );

            // First
            CircleSectorline result1 = sectorElementCollection.CircleSectorLines[0];

            Assert.Equal("BBTWR", result1.Name);
            Assert.Equal("EGBB", result1.CentrePoint);
            Assert.Equal(2.5, result1.Radius);
            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);
            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);
            AssertExpectedMetadata(result1.DisplayRules[1], 9, "comment2");


            // Second
            Sectorline result2 = sectorElementCollection.SectorLines[0];

            Assert.Equal("JJCTR - LS", result2.Name);
            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);
            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);
            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);
            AssertExpectedMetadata(result2.Coordinates[0], 4, "comment9");

            Assert.Equal(new Coordinate("N050.00.00.000", "W001.47.00.000"), result2.Coordinates[1].Coordinate);
            AssertExpectedMetadata(result2.Coordinates[1], 5, "comment10");
        }
        public void TestItAddsSectorlines()
        {
            RunParserOnLines(
                new List <string>(new[] {
                "SECTORLINE:JJCTR - S6 ;comment1",
                "DISPLAY:London S6:JJCTR:London S6 ;comment2",
                "DISPLAY:JJCTR:JJCTR:London S6 ;comment3",
                "COORD:N050.00.00.000:W002.40.34.000 ;comment4",
                "COORD:N049.59.59.000:W002.29.35.000 ;comment5",
                "SECTORLINE:JJCTR - LS ;comment6",
                "DISPLAY:London AC Worthing:JJCTR:London AC Worthing ;comment7",
                "DISPLAY:JJCTR:JJCTR:London AC Worthing ;comment8",
                "COORD:N049.59.59.000:W002.29.35.000 ;comment9",
                "COORD:N050.00.00.000:W001.47.00.000 ;comment10",
            })
                );

            // First
            Sectorline result1 = sectorElementCollection.SectorLines[0];

            Assert.Equal("JJCTR - S6", result1.Name);
            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);
            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);
            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);
            AssertExpectedMetadata(result1.Coordinates[0], 4, "comment4");

            Assert.Equal(new Coordinate("N049.59.59.000", "W002.29.35.000"), result1.Coordinates[1].Coordinate);
            AssertExpectedMetadata(result1.Coordinates[1], 5, "comment5");

            // Second
            Sectorline result2 = sectorElementCollection.SectorLines[1];

            Assert.Equal("JJCTR - LS", result2.Name);
            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);
            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);
            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);
            AssertExpectedMetadata(result2.Coordinates[0], 9, "comment9");

            Assert.Equal(new Coordinate("N050.00.00.000", "W001.47.00.000"), result2.Coordinates[1].Coordinate);
            AssertExpectedMetadata(result2.Coordinates[1], 10, "comment10");
        }