Exemple #1
0
        public void PathProgressionWrongProgressionTest()
        {
            var origin = new CoordinateInt2D()
            {
                X = 6,
                Y = 3
            };
            var destination = new CoordinateInt2D()
            {
                X = 0,
                Y = 0
            };

            Action pathProgressionAction = () =>
            {
                origin.PathProgression(destination, 2);
            };

            pathProgressionAction.Should().Throw <Exception>()
            .WithMessage("progression must be a percentage between 0 and 1 (including)");
        }
Exemple #2
0
        public void PathProgressionNegativeTest()
        {
            var origin = new CoordinateInt2D()
            {
                X = 6,
                Y = 3
            };
            var destination = new CoordinateInt2D()
            {
                X = 0,
                Y = 0
            };

            var expected = new CoordinateInt2D()
            {
                X = 2,
                Y = 1
            };

            var actual = origin.PathProgression(destination, 0.6666666);

            actual.Should().BeEquivalentTo(expected);
        }
Exemple #3
0
        public void PathProgressionTest()
        {
            var origin = new CoordinateInt2D()
            {
                X = 0,
                Y = 0
            };
            var destination = new CoordinateInt2D()
            {
                X = 10,
                Y = 10
            };

            var expected = new CoordinateInt2D()
            {
                X = 5,
                Y = 5
            };

            var actual = origin.PathProgression(destination, 0.5);

            actual.Should().BeEquivalentTo(expected);
        }