Esempio n. 1
0
        public void BidirectionalDisconnectTest()
        {
            SpaceGraph basic = new SpaceGraph();

            basic.CreateNode(0);
            basic.CreateNode(1);
            //0->1
            basic.Connect(0, 1);
            basic.Connect(1, 0);
            Assert.IsTrue(basic.Node(0).IsConnected(basic.Node(1)));
            Assert.IsTrue(basic.Node(1).IsConnected(basic.Node(0)));


            basic.Disconnect(0, 1);

            Assert.AreEqual(0, basic.Node(0).Edges.Count);
            Assert.AreEqual(0, basic.Node(1).Edges.Count);

            //1->0
            basic.Connect(0, 1);
            basic.Connect(1, 0);
            Assert.IsTrue(basic.Node(0).IsConnected(basic.Node(1)));
            Assert.IsTrue(basic.Node(1).IsConnected(basic.Node(0)));

            basic.Disconnect(1, 0);

            Assert.AreEqual(0, basic.Node(0).Edges.Count);
            Assert.AreEqual(0, basic.Node(1).Edges.Count);
        }
Esempio n. 2
0
        public void DisconnectTest()
        {
            SpaceGraph basic = new SpaceGraph();

            basic.CreateNode(0);
            basic.CreateNode(1);
            basic.Connect(0, 1);
            Assert.IsTrue(basic.Node(0).IsConnected(basic.Node(1)));
            Assert.IsTrue(basic.Node(1).IsConnected(basic.Node(0)));

            basic.Disconnect(0, 1);
            Assert.IsFalse(basic.Node(0).IsConnected(basic.Node(1)));
            Assert.IsFalse(basic.Node(1).IsConnected(basic.Node(0)));
        }