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); }
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); }
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]); } }