Exemple #1
0
        public void Rotate180Test(
            [ValueSource("s_ValidPoints")] TestHexPoint source,
            [ValueSource("s_180RotatedValidPoints")] TestHexPoint expected)
        {
            // Arrange
            var point         = new HexPoint(source.x, source.y);
            var expectedPoint = new HexPoint(expected.x, expected.y);

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

            // Assert
            Assert.AreEqual(expectedPoint, point);
        }
Exemple #2
0
        public void TripleRotateTest(
            [Random(-10000, 10000, 5)] int x,
            [Random(-10000, 10000, 5)] int y)
        {
            // Arrange
            var pointA        = new HexPoint(x, y);
            var pointB        = new HexPoint(x, y);
            var expectedPoint = HexPoint.Rotate180(new HexPoint(x, y));

            // Act
            pointA = HexPoint.RotateLeft(HexPoint.RotateLeft(HexPoint.RotateLeft(pointA)));
            pointB = HexPoint.RotateRight(HexPoint.RotateRight(HexPoint.RotateRight(pointB)));

            // Assert
            Assert.AreEqual(expectedPoint, pointA);
            Assert.AreEqual(expectedPoint, pointB);
        }