Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public void ShouldCreateBucketFillCommand()
        {
            var command = DrawingCommandFactory.CreateCommand(CommandNames.BUCKET_FILL, new Drawing.Canvas(1, 2));

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

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

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

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