Пример #1
0
        public void ConnectAsymmetricallyTest()
        {
            var a = new PathNode();
            var b = new PathNode();

            a.ConnectAsymmetrically(b, true);
            Assert.IsTrue(a.Connections.Contains(b));
            Assert.IsFalse(b.Connections.Contains(a));

            a.DisconnectAsymmetrically(b);
            b.ConnectAsymmetrically(a);
            a.ConnectAsymmetrically(b, true);
            Assert.IsTrue(a.Connections.Contains(b));
            Assert.IsFalse(b.Connections.Contains(a));

            a.DisconnectAsymmetrically(b);
            a.ConnectAsymmetrically(b, false);
            Assert.IsTrue(a.Connections.Contains(b));
            Assert.IsFalse(b.Connections.Contains(a));

            a.DisconnectAsymmetrically(b);
            b.ConnectAsymmetrically(a);
            a.ConnectAsymmetrically(b, false);
            Assert.IsTrue(a.Connections.Contains(b));
            Assert.IsTrue(b.Connections.Contains(a));
        }
Пример #2
0
        private static PathFindingTestCase ImpossiblePathTestCase()
        {
            var a = new PathNode();
            var b = new PathNode();
            var c = new PathNode();

            a.ConnectSymmetrically(b);
            b.ConnectSymmetrically(c);
            b.DisconnectAsymmetrically(c);
            return(new PathFindingTestCase(new PathRequest(a, c), PathfindingState.Failed, null));
        }