Ejemplo n.º 1
0
        public void RayEndPoints()
        {
            var min = Vector.Create(5, 5);
            var max = Vector.Create(7, 7);

            Func <IEnumerable <Vector>, Vector[]> prepare =
                vectors => vectors
                .OrderBy(v => v.X)
                .ThenBy(v => v.Y)
                .ToArray();

            var expected = prepare(
                new[]
            {
                Vector.Create(5, 5),
                Vector.Create(5, 6),
                Vector.Create(5, 7),
                Vector.Create(7, 5),
                Vector.Create(7, 6),
                Vector.Create(7, 7),
                Vector.Create(6, 5),
                Vector.Create(6, 7)
            });

            var result = prepare(LineOfSight.RayEndPoints(min, max));

            CollectionAssert.AreEqual(expected, result);
        }