示例#1
0
        public void ConnectSymmetricallyTest()
        {
            var a = new PathNode();
            var b = new PathNode();

            a.ConnectSymmetrically(b);
            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));
        }
示例#3
0
        public static IEnumerable <PathFindingTestCase> EnumerateTestCases()
        {
            var pointA = new PathNode {
                Position = new Vector3(-1, 0, 0)
            };
            var pointB = new PathNode {
                Position = new Vector3(1, 0, 0)
            };
            var pointC = new PathNode {
                Position = new Vector3(-2, 0, 4)
            };

            pointA.ConnectSymmetrically(pointB);
            pointB.ConnectSymmetrically(pointC);

            yield return(new PathFindingTestCase(new PathRequest(pointA, pointB), PathfindingState.Successful, 2));

            yield return(new PathFindingTestCase(new PathRequest(pointA, pointC), PathfindingState.Successful, 7));

            yield return(ImpossiblePathTestCase());
        }