Esempio n. 1
0
        public void TestDependencyPathsAreResolvedToNames()
        {
            var decodedGraph = HierarchicalGraphDecoder.Decode(
                @"
                @Client:
                Lib\Logic
                @Lib:
                @Lib\Logic:", (name, path) => new TestGraphNode(name)
                , (previous, add) => previous.WithChildren(add));
            var nodes = decodedGraph.Tree;
            var edges = decodedGraph.Dependencies;

            // Assert
            nodes.Should().ContainSingle(x => x.Name == "Client");
            edges[nodes.First(x => x.Name == "Client")].Should().Contain(x => x.Name == "Logic");
        }
Esempio n. 2
0
        public void UnFlattens()
        {
            var nodes = HierarchicalGraphDecoder.Decode(
                @"
                @AA:
                @AA\EE:
                @AA\FF:
                @BB:
                @BB\CC:
                @BB\DD:", (name, path) => new TestGraphNode(name), (previous, add) => previous.WithChildren(add)).Tree;

            // Assert

            nodes.Should()
            .Contain(x => x.Name == "AA").Which.Children.Should()
            .Contain(x => x.Name == "EE").And
            .Contain(x => x.Name == "FF");

            nodes.Should()
            .Contain(x => x.Name == "BB").Which.Children.Should()
            .Contain(x => x.Name == "DD").And
            .Contain(x => x.Name == "CC");
        }
Esempio n. 3
0
File: Decode.cs Progetto: davjs/Flat
 public static TreeWithDependencies <T> HierarchicalGraph <T>(string text,
                                                              Delegates.CreateNodeFromNameAndPath <T> createNodeWithName,
                                                              Delegates.AddChildrenToNode <T> addChildrenToNode)
 => HierarchicalGraphDecoder.Decode(text, createNodeWithName, addChildrenToNode);