Ejemplo n.º 1
0
        public void TestCreateIsVisible(Vector location, bool expected)
        {
            var min = Vector.Create(5, 5);
            var max = Vector.Create(15, 15);

            Func <Vector, Vector> mapper =
                vector => Vector.Create(vector.X - min.X, vector.Y - min.Y);

            var viewPort = ImmutableGrid <bool>
                           .CreateBuilder(max.X - min.X + 1, max.Y - min.Y + 1)
                           .Set(5, 5, true)
                           .Build();

            var isVisible = LineOfSight
                            .CreateIsVisible(min, max, mapper, viewPort)(location);

            Assert.AreEqual(expected, isVisible);
        }