Example #1
0
        public void Should_ReturnCorrectRectangle_When_LengthAndWidthAreValid()
        {
            var rectangleFactory = new RectangleFactory();
            var pointFactory     = new MockPointFactory(new Point(0, 0), new Point(30, 40));
            var rectangle        = rectangleFactory.CreateRectangle(pointFactory, 30, 40);

            Assert.AreEqual(0, rectangle.BottomLeft.X);
            Assert.AreEqual(0, rectangle.BottomLeft.Y);
            Assert.AreEqual(30, rectangle.BottomRight.X);
            Assert.AreEqual(0, rectangle.BottomRight.Y);
            Assert.AreEqual(30, rectangle.TopRight.X);
            Assert.AreEqual(40, rectangle.TopRight.Y);
            Assert.AreEqual(0, rectangle.TopLeft.X);
            Assert.AreEqual(40, rectangle.TopLeft.Y);
            Assert.AreEqual(30, rectangle.XLength);
            Assert.AreEqual(40, rectangle.YLength);
        }
Example #2
0
        public void Should_ReturnCorrectRectangle_When_RectanglePointsStringIsValid()
        {
            var rectangleFactory = new RectangleFactory();
            var pointFactory     = new MockPointFactory(new Point(10, 23), new Point(34, 50));
            var rectangle        = rectangleFactory.CreateRectangle(pointFactory, "10 23 34 50");

            Assert.AreEqual(10, rectangle.BottomLeft.X);
            Assert.AreEqual(23, rectangle.BottomLeft.Y);
            Assert.AreEqual(34, rectangle.BottomRight.X);
            Assert.AreEqual(23, rectangle.BottomRight.Y);
            Assert.AreEqual(34, rectangle.TopRight.X);
            Assert.AreEqual(50, rectangle.TopRight.Y);
            Assert.AreEqual(10, rectangle.TopLeft.X);
            Assert.AreEqual(50, rectangle.TopLeft.Y);
            Assert.AreEqual(24, rectangle.XLength);
            Assert.AreEqual(27, rectangle.YLength);
        }