示例#1
0
        public void OffSetShouldMoveAsExpected()
        {
            var subject = new Area(new Point(12.34, 45.56), new Point(67.67, 89.90));
            Area result = subject.Offset(1, 1);

            Assert.AreEqual(13.34, result.TopLeft.X);
            Assert.AreEqual(46.56, result.TopLeft.Y);
            Assert.AreEqual(68.67, result.BottomRight.X);
            Assert.AreEqual(90.90, result.BottomRight.Y);
        }
示例#2
0
        public void OffSetShouldNotReassignReference()
        {
            var subject = new Area(new Point(12.34, 45.56), new Point(67.67, 89.90));
            Area result = subject.Offset(1, 1);

            // Ensure it doesnt change after creation, ie cloned.
            subject.Offset(1, 1);

            Assert.AreNotEqual(result.TopLeft, subject.TopLeft);
            Assert.AreNotEqual(result.BottomRight, subject.BottomRight);
        }