Example #1
0
        public void DoubleRightRotateTest(
            [Random(-10000, 10000, 5)] int x,
            [Random(-10000, 10000, 5)] int y)
        {
            // Arrange
            var point         = new HexPoint(x, y);
            var expectedPoint = HexPoint.RotateRight(HexPoint.RotateRight(point));

            // Act
            point = HexPoint.RotateRight120(point);

            // Assert
            Assert.AreEqual(expectedPoint, point);
        }
Example #2
0
        public void Right120RotateTest(
            [ValueSource("s_LeftRotatedValidPoints")] TestHexPoint source,
            [ValueSource("s_RightRotatedValidPoints")] TestHexPoint expected)
        {
            // Arrange
            var point         = new HexPoint(source.x, source.y);
            var expectedPoint = new HexPoint(expected.x, expected.y);

            // Act
            point = HexPoint.RotateRight120(point);

            // Assert
            Assert.AreEqual(expectedPoint, point);
        }
Example #3
0
        public void DoubleRightOffsetRotateTest(
            [Random(-10000, 10000, 25)] int x,
            [Random(-10000, 10000, 25)] int y,
            [Random(-10000, 10000, 25)] int offsetX,
            [Random(-10000, 10000, 25)] int offsetY)
        {
            // Arrange
            var point         = new HexPoint(x, y);
            var offsetPoint   = new HexPoint(offsetX, offsetY);
            var expectedPoint = HexPoint.RotateRight(HexPoint.RotateRight(point, offsetPoint), offsetPoint);

            // Act
            point = HexPoint.RotateRight120(point, offsetPoint);

            // Assert
            Assert.AreEqual(expectedPoint, point);
        }