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


C# AdjList.BasicAdjList类代码示例

本文整理汇总了C#中BlueSpider.Blob.Basic.Network.AdjList.BasicAdjList的典型用法代码示例。如果您正苦于以下问题:C# BasicAdjList类的具体用法?C# BasicAdjList怎么用?C# BasicAdjList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BasicAdjList类属于BlueSpider.Blob.Basic.Network.AdjList命名空间,在下文中一共展示了BasicAdjList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ChangeEventsEnabled_When_False_Prevents_NetworkChanged_Fired_When_RemoveEdge_Is_Called

        public void ChangeEventsEnabled_When_False_Prevents_NetworkChanged_Fired_When_RemoveEdge_Is_Called(int nodeCount, int edgeCount, int edgesToRemove)
        {
            //Arrange
            var net = new BasicAdjList(Guid.NewGuid());
            Random rand = new Random();
            for (int i = 0; i < nodeCount; i++)
                net.CreateNode();

            INode nodeA = null;
            INode nodeB = null;

            IEdge[] edges = new IEdge[edgeCount];
            for (int i = 0; i < edgeCount; i++)
            {
                nodeA = net.Nodes[rand.Next(nodeCount)];
                nodeB = net.Nodes[rand.Next(nodeCount)];
                edges[i] = net.CreateEdge(nodeA, nodeB);
            }
            //---------------------

            var helper = new NetworkChangedEventsTestHelper();
            net.NetworkChanged += new NetworkChangedEventHandler<INetwork, NetworkChangedEventArgs>(helper.NetworkChanged_DummyHandler);

            net.ChangeEventsEnabled = false;
            for (int i = 0; i < edges.Length; i++)
            {
                net.RemoveEdge(edges[i]);
            }

            Assert.Equal(0, helper.NetworkChanged_TimesCalled);
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:31,代码来源:BasicAdjList_As_INetworkChangeEventsFixture.cs

示例2: ContainsSelfLoops

        public void ContainsSelfLoops()
        {
            var net =new BasicAdjList(Guid.NewGuid());
            BasicNode nodeA = net.CreateNode() as BasicNode;
            BasicNode nodeB = net.CreateNode() as BasicNode;
            BasicNode nodeC = net.CreateNode() as BasicNode;
            BasicNode nodeD = net.CreateNode() as BasicNode;

            net.CreateEdge(nodeA, nodeB);
            net.CreateEdge(nodeA, nodeA);
            net.CreateEdge(nodeA, nodeD);
            net.CreateEdge(nodeD, nodeD);
            net.CreateEdge(nodeD, nodeD);

            bool result = nodeA.ContainsSelfLoops();
            Assert.True(result);

            result = nodeB.ContainsSelfLoops();
            Assert.False(result);

            result = nodeC.ContainsSelfLoops();
            Assert.False(result);

            result = nodeD.ContainsSelfLoops();
            Assert.True(result);
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:26,代码来源:BasicNodeFixture.cs

示例3: AddingEdges_Adds_Row_With_Matching_Key_In_EdgeData

        public void AddingEdges_Adds_Row_With_Matching_Key_In_EdgeData(int nodeCount, int edgeCount)
        {
            Random rand = new Random();
            var net = new BasicAdjList(Guid.NewGuid());
            var table = new DataAttributeTable<IEdge>();
            table.Network = net;
            net.EdgeData = table;

            for (int i = 0; i < nodeCount; i++)
            {
                var node = net.CreateNode();
            }

            INode nodeA = null;
            INode nodeB = null;
            IEdge edge = null;
            for (int i = 0; i < edgeCount; i++)
            {
                nodeA = net.Nodes[rand.Next(nodeCount)];
                nodeB = net.Nodes[rand.Next(nodeCount)];
                edge = net.CreateEdge(nodeA, nodeB);
                Assert.Equal((i + 1), net.EdgeCount);
                Assert.Equal((i + 1), table.RowCount);
                Assert.True(table.RowOwnerMap.ContainsKey(edge));
            }
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:26,代码来源:BasicAdjList_DataAttributes_Fixture.cs

示例4: ModifyIsDirectedProperty

 public void ModifyIsDirectedProperty(BasicAdjList network, bool isDirected)
 {
     if (network.IsDirected != isDirected)
     {
         network.IsDirected = isDirected;
     }
 }
开发者ID:BgRva,项目名称:Blob1,代码行数:7,代码来源:SimpleAdjListDirectedModifier.cs

示例5: AddEdge_Throws_Ex_If_Edge_Is_Null

        public void AddEdge_Throws_Ex_If_Edge_Is_Null()
        {
            var net =new BasicAdjList(Guid.NewGuid());
            BasicNode node0 = new BasicNode(net);

            BasicEdge edge0 = null;
            var ex = Assert.Throws<ArgumentNullException>(() => node0.AddEdge(edge0));
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:8,代码来源:BasicNodeFixture.cs

示例6: AddEdge_Throws_Ex_If_Edge_Is_Invalid_Type

        public void AddEdge_Throws_Ex_If_Edge_Is_Invalid_Type()
        {
            var net =new BasicAdjList(Guid.NewGuid());
            BasicNode node0 = new BasicNode(net);

            DummyBasicEdge edge0 = new DummyBasicEdge();
            var ex = Assert.Throws<ArgumentException>(() => node0.AddEdge(edge0));
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:8,代码来源:BasicNodeFixture.cs

示例7: Contains_ReturnsTrueWhenANodeExists

 public void Contains_ReturnsTrueWhenANodeExists()
 {
     //Arrange
     var net = new BasicAdjList(Guid.NewGuid());
     INode node = net.CreateNode();
     bool result = net.Contains(node);
     Assert.True(result);
 }
开发者ID:BgRva,项目名称:Blob1,代码行数:8,代码来源:BasicAdjListFixture.cs

示例8: Ctor_With_Different_Network_Parent_Than_Source_Node

 public void Ctor_With_Different_Network_Parent_Than_Source_Node()
 {
     //Arrange
     var net = new BasicAdjList(Guid.NewGuid());
     BasicAdjList net2 = new BasicAdjList(Guid.NewGuid());
     var nodeA = new BasicNode(net2);
     var nodeB = new BasicNode(net);
     var ex = Assert.Throws<ArgumentException>(() => new BasicEdge(net, nodeA, nodeB));
 }
开发者ID:BgRva,项目名称:Blob1,代码行数:9,代码来源:BasicEdgeFixture.cs

示例9: Ctor_Throws_Ex_With_Null_Passed_InAsSourceNode

        public void Ctor_Throws_Ex_With_Null_Passed_InAsSourceNode()
        {
            //Arrange
            var net = new BasicAdjList(Guid.NewGuid());
            IBasicNode nodeA = null;
            var nodeB = new BasicNode(net);

            //Act, Assert
            var ex = Assert.Throws<ArgumentException>(() => new BasicEdge(net, nodeA, nodeB));
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:10,代码来源:BasicEdgeFixture.cs

示例10: CreateEdge_Increments_Edge_Count_By_1

 public void CreateEdge_Increments_Edge_Count_By_1()
 {
     //Arrange
     var net = new BasicAdjList(Guid.NewGuid());
     Assert.Equal(0, net.EdgeCount);
     INode nodeA = net.CreateNode();
     INode nodeB = net.CreateNode();
     IEdge edge = net.CreateEdge(nodeA, nodeB);
     Assert.Equal(1, net.EdgeCount);
 }
开发者ID:BgRva,项目名称:Blob1,代码行数:10,代码来源:BasicAdjListFixture.cs

示例11: Ctor_Throws_Ex_With_Null_Passed_In_As_Network

        public void Ctor_Throws_Ex_With_Null_Passed_In_As_Network()
        {
            //Assign
            IBasicAdjList net = new BasicAdjList(Guid.NewGuid());
            var nodeA = new BasicNode(net);
            var nodeB = new BasicNode(net);

            //Act, Assert
            var ex = Assert.Throws<ArgumentNullException>(() => new BasicEdge(null, nodeA, nodeB));
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:10,代码来源:BasicEdgeFixture.cs

示例12: Contains_ReturnsTrueWhenAnEdgeExists

 public void Contains_ReturnsTrueWhenAnEdgeExists()
 {
     //Arrange
     var net = new BasicAdjList(Guid.NewGuid());
     INode nodeA = net.CreateNode();
     INode nodeB = net.CreateNode();
     IEdge edge = net.CreateEdge(nodeA, nodeB);
     bool result = net.Contains(edge);
     Assert.True(result);
 }
开发者ID:BgRva,项目名称:Blob1,代码行数:10,代码来源:BasicAdjListFixture.cs

示例13: EdgeDataAttributeCount_Returns0_IfEdgeDataIsNull

        public void EdgeDataAttributeCount_Returns0_IfEdgeDataIsNull()
        {
            var net = new BasicAdjList(Guid.NewGuid());
            int count = 0;

            net.EdgeData = null;

            int result = net.EdgeDataAttributeCount;

            Assert.Equal(count, result);
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:11,代码来源:BasicAdjList_DataAttributes_Fixture.cs

示例14: CreateEdge_Assigns_Edge_Index

 public void CreateEdge_Assigns_Edge_Index()
 {
     //Arrange
     var net = new BasicAdjList(Guid.NewGuid());
     INode nodeA = net.CreateNode();
     INode nodeB = net.CreateNode();
     INode nodeC = net.CreateNode();
     BasicEdge edgeA = net.CreateEdge(nodeA, nodeB) as BasicEdge;
     BasicEdge edgeB = net.CreateEdge(nodeC, nodeB) as BasicEdge;
     Assert.Equal(0, edgeA.Index);
     Assert.Equal(1, edgeB.Index);
 }
开发者ID:BgRva,项目名称:Blob1,代码行数:12,代码来源:BasicAdjListFixture.cs

示例15: ChangeEventsEnabled_When_False_Prevents_NetworkChanged_Fired_When_CreateNode_Is_Called

        public void ChangeEventsEnabled_When_False_Prevents_NetworkChanged_Fired_When_CreateNode_Is_Called(int nodeCount)
        {
            //Arrange
            var net = new BasicAdjList(Guid.NewGuid());
            var helper = new NetworkChangedEventsTestHelper();
            net.NetworkChanged += new NetworkChangedEventHandler<INetwork, NetworkChangedEventArgs>(helper.NetworkChanged_DummyHandler);

            net.ChangeEventsEnabled = false;
            for (int i = 0; i < nodeCount; i++)
                net.CreateNode();

            Assert.Equal(0, helper.NetworkChanged_TimesCalled);
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:13,代码来源:BasicAdjList_As_INetworkChangeEventsFixture.cs


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