示例#1
0
        public void DrawMethod_Should_Render_Size_XY_Positions_Horizontal_Veritical_Diameters()
        {
            // Arrange
            var widget = new EllipseWidget(50, 50)
            {
                HorizontalDiameter = 30, VerticalDiameter = 30, Size = 6283
            };

            // Act
            var renderedWidget = widget.Draw();

            // Assert
            Assert.NotNull(widget);
            Assert.Equal("Ellipse (50, 50) HorizontalDiameter=30 VerticalDiameter=30 Size=6283", renderedWidget);
        }
示例#2
0
        static void Main(string[] args)
        {
            var requestedWidgets = new List <BaseWidget>();

            var rectangle = new RectangleWidget()
            {
                XCoOrd = 10,
                YCoOrd = 10,
                Height = 30,
                Width  = 40
            };
            var square = new SquareWidget()
            {
                XCoOrd = 15,
                YCoOrd = 30,
                Size   = 35
            };
            var ellipse = new EllipseWidget()
            {
                XCoOrd             = 100,
                YCoOrd             = 150,
                HorizontalDiameter = -300,
                VerticalDiameter   = 200
            };
            var circle = new CircleWidget()
            {
                XCoOrd = 1,
                YCoOrd = 1,
                Size   = 300
            };
            var textBox = new TextBoxWidget()
            {
                XCoOrd = 5,
                YCoOrd = 5,
                Width  = 200,
                Height = 100,
                Text   = "sample text"
            };

            requestedWidgets.Add(rectangle);
            requestedWidgets.Add(square);
            requestedWidgets.Add(ellipse);
            requestedWidgets.Add(circle);
            requestedWidgets.Add(textBox);

            WidgetPrinter.PrintRequestList(requestedWidgets);
        }
示例#3
0
        public void CreateWidget_CheckEllipseForHeightIsInBounds_ReturnsErrorBill()
        {
            // Arrange
            var widget = new EllipseWidget
            {
                XPosition = 100,
                YPosition = 950,
                Width     = 300,
                Height    = 200
            };

            // Act
            var result = MaterialGenService.CreateWidget(widget);

            // Assert
            Assert.IsNotNull(result);
            Assert.IsFalse(string.IsNullOrWhiteSpace(result));
            Assert.AreEqual("+++++Abort+++++", result);
            MockRepository.VerifyAll();
        }
示例#4
0
        public void CreateWidget_CreateEllipseMaterials_ReturnsCorrectBill()
        {
            // Arrange
            var widget = new EllipseWidget
            {
                XPosition = 100,
                YPosition = 150,
                Width     = 300,
                Height    = 200
            };

            // Act
            var result = MaterialGenService.CreateWidget(widget);

            // Assert
            Assert.IsNotNull(result);
            Assert.IsFalse(string.IsNullOrWhiteSpace(result));
            Assert.AreEqual("Ellipse (100,150) diameterH = 300 diameterV = 200", result);
            MockRepository.VerifyAll();
        }
示例#5
0
        private static void Main(string[] args)
        {
            var squareWidget = new SquareWidget(10, 10)
            {
                Size = 1600
            };
            var circleWidget = new CircleWidget(100, 100)
            {
                Size = 20
            };
            var ellipseWidget = new EllipseWidget(50, 50)
            {
                HorizontalDiameter = 30, VerticalDiameter = 30, Size = 6283
            };
            var rectangleWidget = new RectangleWidget(70, 30)
            {
                Height = 4, Width = 8, Size = 32
            };
            var textBoxWithBackgroundColourWidget = new TextBoxWidget(20, 90)
            {
                Height = 6, Width = 24, Size = 144, Text = "Sample text", BackgroundColour = "Blue"
            };
            var textBoxWithDefaultBackgroundColour = new TextBoxWidget(30, 150)
            {
                Height = 6, Width = 24, Size = 144, Text = "Sample text with default colour"
            };

            var canvas = new Canvas();

            canvas.Add(squareWidget);
            canvas.Add(circleWidget);
            canvas.Add(ellipseWidget);
            canvas.Add(rectangleWidget);
            canvas.Add(textBoxWithBackgroundColourWidget);
            canvas.Add(textBoxWithDefaultBackgroundColour);

            canvas.PrintCanvas();
            Console.ReadKey();
        }