Exemplo n.º 1
0
        public void Move()
        {
            double sqrt2 = Math.Sqrt(2);

            Assert.AreEqual(pointD, pointD.Move(pointD, 5));
            Assert.AreEqual(pointD, pointD.Move(new PointD(3, 4), 0));
            Assert.AreEqual(new PointD(2, 2), pointD.Move(new PointD(3, 2), 1));
            Assert.AreEqual(new PointD(0, 2), pointD.Move(new PointD(-1, 2), 1));
            Assert.AreEqual(new PointD(1, 3), pointD.Move(new PointD(1, 0), -1));
            Assert.AreEqual(new PointD(1, 1), pointD.Move(new PointD(1, 4), -1));
            Assert.AreEqual(new PointD(2, 3), pointD.Move(new PointD(3, 4), sqrt2));
            Assert.AreEqual(new PointD(0, 1), pointD.Move(new PointD(3, 4), -sqrt2));

            Assert.AreEqual(pointF, pointF.Move(pointF, 5));
            Assert.AreEqual(pointF, pointF.Move(new PointF(3, 4), 0));
            Assert.AreEqual(new PointF(2, 2), pointF.Move(new PointF(3, 2), 1));
            Assert.AreEqual(new PointF(0, 2), pointF.Move(new PointF(-1, 2), 1));
            Assert.AreEqual(new PointF(1, 3), pointF.Move(new PointF(1, 0), -1));
            Assert.AreEqual(new PointF(1, 1), pointF.Move(new PointF(1, 4), -1));
            Assert.AreEqual(new PointF(2, 3), pointF.Move(new PointF(3, 4), (float)sqrt2));
            Assert.AreEqual(new PointF(0, 1), pointF.Move(new PointF(3, 4), (float)-sqrt2));
        }