Exemplo n.º 1
0
        public void AllFilterGraphTests()
        {
            var map = new GraphMap <string, IGraphNode <string>, IGraphEdge <string> >()
            {
                new GraphNode <string>("Node1"),
                new GraphNode <string>("Node2"),
                new GraphNode <string>("Node3"),
                new GraphNode <string>("Node4"),

                new GraphEdge <string>("Node1", "Node2"),
                new GraphEdge <string>("Node2", "Node3"),
                new GraphEdge <string>("Node1", "Node4"),
            };

            var filter = map.CreateFilter()
                         .Include(map.Nodes["Node1"].Key);

            GraphMap <string, IGraphNode <string>, IGraphEdge <string> > newMap = map.Create(filter);

            newMap.Nodes.Count.Should().Be(4);
            newMap.Nodes.Values.Any(x => x.Key == "Node1").Should().BeTrue();
            newMap.Nodes.Values.Any(x => x.Key == "Node2").Should().BeTrue();
            newMap.Nodes.Values.Any(x => x.Key == "Node3").Should().BeTrue();
            newMap.Nodes.Values.Any(x => x.Key == "Node4").Should().BeTrue();
        }