public void Execute_DrawingStyleChange_Test()
        {
            IDrawingFeatures drawingFeatures = new DrawingFeaturesMock();

            DrawingState drawingState = DrawingState.DrawLine;
            DrawingStyleTool target = new DrawingStyleTool(drawingFeatures, drawingState);

            target.Execute();

            DrawingState actual = drawingFeatures.DrawingState;

            Assert.AreEqual(drawingState,actual);
        }
Example #2
0
        public void CreateIToolObject_RotateTool_Test()
        {
            ToolFactory target = new ToolFactory();

            IDrawingFeatures drawingFeatures = new DrawingFeaturesMock();

            string toolName = "RotateLeft90";

            ITool actual;
            actual = target.CreateIToolObject(drawingFeatures, toolName);

            Assert.IsTrue(actual is RotateTool);
        }
        public void CreateADrawableObject_FillRectangleDrawer_Test()
        {
            DrawableFactory target = new DrawableFactory();

            IDrawingFeatures drawingFeatures = new DrawingFeaturesMock();
            drawingFeatures.DrawingState = DrawingState.DrawFilledRectangle;

            Point startPoint = new Point();

            ADrawable actual;
            actual = target.CreateADrawableObject(drawingFeatures, startPoint);

            Assert.IsTrue(actual is FillRectangleDrawer);
        }
        public void CreateIMenuCommnadObject_SaveCommand_Test()
        {
            MenuCommandFactory target = new MenuCommandFactory();

            IDrawingFeatures drawingFeatures = new DrawingFeaturesMock();

            string menuCommandName = "Save";

            IMenuCommand actual;

            actual = target.CreateIMenuCommnadObject(drawingFeatures, menuCommandName);

            Assert.IsTrue(actual is SaveCommand);
        }
        public void OrangeColorButton_ClickTest()
        {
            DrawingFeaturesMock drawingFeatures = new DrawingFeaturesMock();

            OperationsOnColorButtons target = new OperationsOnColorButtons(drawingFeatures);

            PictureBox sender = new PictureBox();
            sender.BackColor = Color.Orange;

            EventArgs e = new EventArgs();

            Color expected = Color.Orange;

            target.ColorButton_Click(sender, e);

            Assert.AreEqual(expected, drawingFeatures.Pencil.Color);
        }
        public void Execute_PensilChenge_Test()
        {
            IDrawingFeatures drawingFeatures = new DrawingFeaturesMock();

            LineCap lineCapStyle = LineCap.Round;
            LineShapeTool target = new LineShapeTool(drawingFeatures, lineCapStyle);

            Pen expected = new Pen(Color.White);
            expected.StartCap = LineCap.Round;
            expected.EndCap = LineCap.Round;

            target.Execute();

            Pen actual = drawingFeatures.Pencil;

            Assert.AreEqual(expected.StartCap, actual.StartCap);
            Assert.AreEqual(expected.EndCap, actual.EndCap);
        }
Example #7
0
        public void Execute_RotateLeft90_Test()
        {
            IDrawingFeatures drawingFeatures = new DrawingFeaturesMock();
            drawingFeatures.PaintingArea.Image = new Bitmap(100, 500);

            Image expected = new Bitmap(500,100);

            RotateFlipType rotateType = RotateFlipType.Rotate90FlipXY;

            RotateTool target = new RotateTool(drawingFeatures, rotateType);

            target.Execute();

            Image actual = drawingFeatures.PaintingArea.Image;

            Assert.AreEqual(expected.Width, actual.Width);
            Assert.AreEqual(expected.Height, actual.Height);
        }
        public void WidthComboBox_ClickTest()
        {
            IDrawingFeatures drawingFeatures = new DrawingFeaturesMock();

            Pen expected = new Pen(Color.Black,40);

            OperationsOnToolButtons target = new OperationsOnToolButtons(drawingFeatures);

            ComboBox sender = new ComboBox();
            sender.Items.AddRange(new object[] { "1", "5", "20", "40" });
            sender.SelectedIndex = 3;

            EventArgs e = new EventArgs();

            target.WidthComboBox_Click(sender, e);

            Pen actual = drawingFeatures.Pencil;

            Assert.AreEqual(expected.Width, actual.Width);
        }