示例#1
0
        public void ToScreenCoordinates_CoordinateNull_ThrowArgumentNullException()
        {
            // Setup
            var worldFile = new WorldFile(1.0, 0.0, 0.0, 1.0, 0.0, 0.0);

            // Call
            TestDelegate call = () => worldFile.ToScreenCoordinates(null);

            // Assert
            string paramName = Assert.Throws <ArgumentNullException>(call).ParamName;

            Assert.AreEqual("point", paramName);
        }
示例#2
0
        public void GivenScreenSpaceCoordinate_WhenDoingRoundtripTransformation_ThenScreenSpaceCoordinateRemainsUnchanged()
        {
            // Given
            const double a11             = 1.1;
            const double a21             = 2.2;
            const double a12             = 3.3;
            const double a22             = 4.4;
            const double transformationX = 5.5;
            const double transformationY = 6.6;

            var worldFile = new WorldFile(a11, a21, a12, a22, transformationX, transformationY);

            const int x = 20;
            const int y = 17;

            // When
            Coordinate worldCoordinate  = worldFile.ToWorldCoordinates(x, y);
            Point      screenCoordinate = worldFile.ToScreenCoordinates(worldCoordinate);

            // Assert
            Assert.AreEqual(x, screenCoordinate.X);
            Assert.AreEqual(y, screenCoordinate.Y);
        }