public void Execute(string commandName, params string[] parameters)
        {
            var command = DrawingCommandFactory.CreateCommand(commandName, _canvas);

            command.Draw(parameters);
            if (commandName == CommandNames.CANVAS)
            {
                _canvas = ((CanvasDrawingCommand)command).Canvas;
            }
            _drawingRender.Render(_canvas);
        }
Exemple #2
0
        public void ShouldCreateBucketFillCommand()
        {
            var command = DrawingCommandFactory.CreateCommand(CommandNames.BUCKET_FILL, new Drawing.Canvas(1, 2));

            Assert.IsInstanceOf <BucketFillDrawingCommand>(command);
        }
Exemple #3
0
 public void ShouldThrowExceptionWhenCreateBucketFillCommandWithoutCanvas()
 {
     Assert.That(() => {
         DrawingCommandFactory.CreateCommand(CommandNames.BUCKET_FILL);
     }, Throws.InstanceOf <ArgumentException>());
 }
Exemple #4
0
 public void ShouldThrowExceptionWhenCreateDrawRetangleCommandWithoutCanvas()
 {
     Assert.That(() => {
         DrawingCommandFactory.CreateCommand(CommandNames.RECTANGLE);
     }, Throws.InstanceOf <ArgumentException>());
 }
Exemple #5
0
        public void ShouldCreateDrawRetangleCommand()
        {
            var command = DrawingCommandFactory.CreateCommand(CommandNames.RECTANGLE, new Drawing.Canvas(1, 2));

            Assert.IsInstanceOf <RectangleDrawingCommand>(command);
        }
Exemple #6
0
        public void ShouldCreateDrawLineCommand()
        {
            var command = DrawingCommandFactory.CreateCommand(CommandNames.LINE, new Drawing.Canvas(1, 2));

            Assert.IsInstanceOf <LineDrawingCommand>(command);
        }
Exemple #7
0
        public void ShouldCreateDrawCanvasCommand()
        {
            var command = DrawingCommandFactory.CreateCommand(CommandNames.CANVAS);

            Assert.IsInstanceOf <CanvasDrawingCommand>(command);
        }
Exemple #8
0
 public void ShouldThrowExceptionWhenCommandNameNotExists()
 {
     Assert.That(() => {
         DrawingCommandFactory.CreateCommand("invalid command");
     }, Throws.InstanceOf <NotSupportedException>());
 }