Example #1
0
        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"
            });

            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"));

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

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

            AssertCollectedItems(expected);
        }
        public void TestItAddsStarRoutes()
        {
            SidStarRoute route = SidStarRouteFactory.Make(SidStarType.STAR);

            collection.Add(route);
            Assert.Equal(route, collection.StarRoutes[0]);
        }
        public void TestItAddsMultiRowElements()
        {
            RunParserOnLines(new List <string>(
                                 new[] {
                "Test                       abc abc def def ;comment",
                "                           def def ghi ghi ;comment"
            }
                                 ));


            List <RouteSegment> expectedAdditionalSegments = new()
            {
                new RouteSegment(
                    "Test",
                    new Point("def"),
                    new Point("ghi"),
                    DefinitionFactory.Make(),
                    DocblockFactory.Make(),
                    CommentFactory.Make()
                    ),
            };

            SidStarRoute result = sectorElementCollection.SidRoutes[0];

            Assert.Equal("Test", result.Identifier);
            Assert.Equal(
                new RouteSegment(
                    "Test",
                    new Point("abc"),
                    new Point("def"),
                    DefinitionFactory.Make(),
                    DocblockFactory.Make(),
                    CommentFactory.Make()
                    ),
                result.InitialSegment
                );
            Assert.Equal(expectedAdditionalSegments, result.Segments);

            AssertExpectedMetadata(result);
            AssertExpectedMetadata(result.InitialSegment);
            AssertExpectedMetadata(result.Segments[0], 2);
        }
        public void TestItAddsMultipleElementsWithColour()
        {
            RunParserOnLines(new List <string>(
                                 new[] {
                "Test                       abc abc def def Red",
                "                           def def ghi ghi Yellow ;comment",
                "Test 2                     jkl jkl mno mno Blue;comment"
            }
                                 ));

            List <RouteSegment> expectedAdditionalSegments1 = new()
            {
                new RouteSegment(
                    "Test",
                    new Point("def"),
                    new Point("ghi"),
                    DefinitionFactory.Make(),
                    DocblockFactory.Make(),
                    CommentFactory.Make(),
                    "Yellow"
                    )
            };


            SidStarRoute result = sectorElementCollection.SidRoutes[0];

            Assert.Equal("Test", result.Identifier);
            Assert.Equal(
                new RouteSegment(
                    "Test",
                    new Point("abc"),
                    new Point("def"),
                    DefinitionFactory.Make(),
                    DocblockFactory.Make(),
                    CommentFactory.Make(),
                    "Red"
                    ),
                result.InitialSegment
                );
            Assert.Equal(expectedAdditionalSegments1, result.Segments);
            AssertExpectedMetadata(result, commentString: "");
            AssertExpectedMetadata(result.InitialSegment, commentString: "");
            AssertExpectedMetadata(result.Segments[0], 2);

            SidStarRoute result2 = sectorElementCollection.SidRoutes[1];

            Assert.Equal("Test 2", result2.Identifier);
            Assert.Equal(
                new RouteSegment(
                    "Test",
                    new Point("jkl"),
                    new Point("mno"),
                    DefinitionFactory.Make(),
                    DocblockFactory.Make(),
                    CommentFactory.Make(),
                    "Blue"
                    ),
                result2.InitialSegment
                );
            Assert.Empty(result2.Segments);
            AssertExpectedMetadata(result2, 3);
            AssertExpectedMetadata(result2.InitialSegment, 3);
        }