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

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

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

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

            // Assert
            Assert.AreEqual(expectedPoint, point);
        }
Beispiel #3
0
        public void DoubleLeftOffsetRotateTest(
            [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.RotateLeft(HexPoint.RotateLeft(point, offsetPoint), offsetPoint);

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

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