示例#1
0
        public void TestMoveAlongVector()
        {
            //Arrange
            Point2D[] actual;
            Point2D[] expected =
            {
                new Point2D(2, 2),
                new Point2D(3, 2),
                new Point2D(3, 3),
                new Point2D(2, 3)
            };
            IVector vector =
                new GeometryLib.Fakes.StubIVector()
            {
                GetVector = () => { return(new double[] { 1, 1 }); },
                GetLength = () => { return(2); }
            };

            //Act
            testPolygon.MoveAlongVector(vector);
            actual = testPolygon.GetPoints();
            //Assert
            Console.WriteLine("{0}--{1}", actual[0].Print(), expected[0].Print());
            Assert.IsTrue(PointListComparator(expected, actual));
        }
示例#2
0
        public void TestErrorMovingAlongVector()
        {
            //Arrange
            IVector vector =
                new GeometryLib.Fakes.StubIVector()
            {
                GetLength = () => { return(3); }
            };

            //Act
            testPolygon.MoveAlongVector(vector);
        }
示例#3
0
        public void TestMovingByVector()
        {
            // Arrange:
            double[] expected = { 15.0, 23.0 };

            IVector vector =
                new GeometryLib.Fakes.StubIVector()
            {
                GetVector = () => { return(new double[] { 4, 3 }); }
            };

            // Act:
            testPoint1.MoveByVector(vector, 1);
            // Assert:
            CollectionAssert.AreEqual(expected,
                                      (new[] { testPoint1.X, testPoint1.Y }));
        }