当前位置: 首页>>代码示例>>C#>>正文


C# Graph.PrepareView方法代码示例

本文整理汇总了C#中Graph.PrepareView方法的典型用法代码示例。如果您正苦于以下问题:C# Graph.PrepareView方法的具体用法?C# Graph.PrepareView怎么用?C# Graph.PrepareView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Graph的用法示例。


在下文中一共展示了Graph.PrepareView方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NodeViewShouldNotIncludeLinksNotMatchingPredicate

        public void NodeViewShouldNotIncludeLinksNotMatchingPredicate()
        {
            // arrange
            var graph = new Graph();

            var nodeA1 = graph.AddNode(new SampleNode("A1"));
            var nodeA2 = graph.AddNode(new SampleNode("A2"));

            var link1 = graph.AddLink(nodeA1, nodeA2, new SampleLink("1"));
            var link2 = graph.AddLink(nodeA1, nodeA2, new SampleLink("2"));

            // act
            var view = graph.PrepareView(x => x.Id.StartsWith("A"), x => ((SampleLink)x).Name != "1");

            // assert
            var nodeA1View = view.Nodes.Single(x => x.Node == nodeA1);

            Assert.That(nodeA1View.OutboundLinks, Has.No.Member(link1));
        }
开发者ID:Novakov,项目名称:HighLevelCodeAnalysis,代码行数:19,代码来源:GraphViewTest.cs

示例2: ShouldFilterOutLinks

        public void ShouldFilterOutLinks()
        {
            // arrange
            var graph = new Graph();

            var nodeA1 = graph.AddNode(new SampleNode("A1"));
            var nodeA2 = graph.AddNode(new SampleNode("A2"));

            var link1 = graph.AddLink(nodeA1, nodeA2, new SampleLink("1"));
            var link2 = graph.AddLink(nodeA1, nodeA2, new SampleLink("2"));

            // act
            var view = graph.PrepareView(x => true, x => (x is SampleLink) && ((SampleLink)x).Name == "1");

            // assert
            Assert.That(view.Links, Has
                .Member(link1)
                .And.Not.Member(link2),
                "Nodes has not been filtered");
        }
开发者ID:Novakov,项目名称:HighLevelCodeAnalysis,代码行数:20,代码来源:GraphViewTest.cs

示例3: ShouldFilterOutNodes

        public void ShouldFilterOutNodes()
        {
            // arrange
            var graph = new Graph();

            var nodeA1 = graph.AddNode(new SampleNode("A1"));
            var nodeA2 = graph.AddNode(new SampleNode("A2"));

            var nodeB1 = graph.AddNode(new SampleNode("B1"));
            var nodeB2 = graph.AddNode(new SampleNode("B2"));

            // act
            var view = graph.PrepareView(x => x.Id.StartsWith("A"), x => true);

            // assert
            Assert.That(view.Nodes.Select(x => x.Node), Has
                .Member(nodeA1)
                .And.Member(nodeA2)
                .And.Not.Member(nodeB1)
                .And.Not.Member(nodeB2),
                "Nodes has not been filtered");
        }
开发者ID:Novakov,项目名称:HighLevelCodeAnalysis,代码行数:22,代码来源:GraphViewTest.cs

示例4: ShouldNotIncludeLinksWithEndNotMatchingPredicate

        public void ShouldNotIncludeLinksWithEndNotMatchingPredicate()
        {
            // arrange
            var graph = new Graph();

            var nodeA1 = graph.AddNode(new SampleNode("A1"));
            var nodeA2 = graph.AddNode(new SampleNode("A2"));

            var nodeB1 = graph.AddNode(new SampleNode("B1"));
            var nodeB2 = graph.AddNode(new SampleNode("B2"));

            var link1 = graph.AddLink(nodeA1, nodeB2, new SampleLink("1"));
            var link2 = graph.AddLink(nodeB1, nodeA2, new SampleLink("2"));
            var link3 = graph.AddLink(nodeA1, nodeA2, new SampleLink("3"));

            // act
            var view = graph.PrepareView(x => x.Id.StartsWith("A"), x => true);

            // assert
            Assert.That(view.Links, Has
                .No.Member(link1)
                .And.No.Member(link2)
                .And.Member(link3));
        }
开发者ID:Novakov,项目名称:HighLevelCodeAnalysis,代码行数:24,代码来源:GraphViewTest.cs


注:本文中的Graph.PrepareView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。