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 ITool CreateIToolObject(IDrawingFeatures drawingFeatures, string toolName) { switch (toolName) { case "RotateLeft90": { ITool tool = new RotateTool(drawingFeatures, RotateFlipType.Rotate90FlipXY); return tool; } case "RotateRight90": { ITool tool = new RotateTool(drawingFeatures, RotateFlipType.Rotate90FlipNone); return tool; } case "RotateRight180": { ITool tool = new RotateTool(drawingFeatures, RotateFlipType.Rotate180FlipNone); return tool; } case "RotateRight270": { ITool tool = new RotateTool(drawingFeatures, RotateFlipType.Rotate270FlipNone); return tool; } case "VerticalFlip": { ITool tool = new RotateTool(drawingFeatures, RotateFlipType.RotateNoneFlipY); return tool; } case "HorizontalFlip": { ITool tool = new RotateTool(drawingFeatures, RotateFlipType.RotateNoneFlipX); return tool; } case "HorizontalAndVerticalFlip": { ITool tool = new RotateTool(drawingFeatures, RotateFlipType.RotateNoneFlipXY); return tool; } case "RoundLine": { ITool tool = new LineShapeTool(drawingFeatures, LineCap.Round); return tool; } case "SquareLine": { ITool tool = new LineShapeTool(drawingFeatures, LineCap.Square); return tool; } case "Circle": { ITool tool = new DrawingStyleTool(drawingFeatures,DrawingState.DrawCircle); return tool; } case "Rectangle": { ITool tool = new DrawingStyleTool(drawingFeatures, DrawingState.DrawRectangle); return tool; } case "FilledCircle": { ITool tool = new DrawingStyleTool(drawingFeatures, DrawingState.DrawFilledCircle); return tool; } case "FilledRectangle": { ITool tool = new DrawingStyleTool(drawingFeatures, DrawingState.DrawFilledRectangle); return tool; } case "Line": { ITool tool = new DrawingStyleTool(drawingFeatures, DrawingState.DrawLine); return tool; } case "Pencil": { ITool tool = new DrawingStyleTool(drawingFeatures, DrawingState.DrawPencil); return tool; } case "Eraser": { ITool tool = new EraserTool(drawingFeatures); return tool; } case "FloodFill": { ITool tool = new DrawingStyleTool(drawingFeatures, DrawingState.FloodFill); return tool; } default: { ITool tool = new NullTool(); Logger logger = new Logger(); logger.Log(new ArgumentException("ToolFactory - ToolName: " + toolName)); return tool; } } }