예제 #1
0
        public void ExecuteCommand_Canvas_Not_Exists()
        {
            string[]   args       = new string[] { "1", "2", "6", "2" };
            CreateLine createLine = new CreateLine(null);
            var        exception  = Record.Exception(() => createLine.ExecuteCommand(args));

            Assert.NotNull(exception);
            Assert.IsType <ArgumentException>(exception);
            Assert.Equal($"{Constants.Command_Canvas_Not_Exists}", exception.Message);
        }
예제 #2
0
        public void ExecuteCommand_Invalid_Argument(string CommandName, string[] args)
        {
            CreateLine createLine = new CreateLine(_canvas.Object);
            var        exception  = Record.Exception(() => createLine.ExecuteCommand(args));

            Assert.NotNull(exception);
            Assert.IsType <ArgumentException>(exception);
            Assert.Equal($"{Constants.Command_Expect_Four_Positive_Arguments}", exception.Message);
            Assert.Equal("L", CommandName);
        }
예제 #3
0
        public void ExecuteCommand_Create_Line_Success()
        {
            CreateCanvas createCanvas = new CreateCanvas();

            string[] args1  = new string[] { "20", "4" };
            var      canvas = createCanvas.ExecuteCommand(args1);

            string[]   args       = new string[] { "1", "2", "6", "2" };
            CreateLine createLine = new CreateLine(canvas);
            var        result     = createLine.ExecuteCommand(args);

            Assert.NotNull(result);
            for (int i = 1; i <= 6; i++)
            {
                Assert.Equal('x', canvas.Cells[i, 2]);
            }
        }