Example #1
0
        public void Draw(params string[] parameters)
        {
            CommandParameterValidator.ValidateParameterCount(3, parameters);

            int.TryParse(parameters[0], out int x1);
            int.TryParse(parameters[1], out int y1);

            CommandParameterValidator.ValidateXaxisValueRange(_canvas, x1);
            CommandParameterValidator.ValidateYaxisValueRange(_canvas, y1);

            var color = parameters[2];

            validateColor(color);

            bucketFill(x1, y1, color);
        }
Example #2
0
        public void Draw(params string[] parameters)
        {
            CommandParameterValidator.ValidateParameterCount(2, parameters);

            int.TryParse(parameters[0], out var width);
            int.TryParse(parameters[1], out var height);
            if (width <= 0)
            {
                throw new ArgumentException("width should be a positive integer");
            }
            if (height <= 0)
            {
                throw new ArgumentException("height should be a positive integer");
            }
            Canvas = new Canvas(width, height);
        }