public CommandValidationResult Validate() { var commandValidationResult = new CommandValidationResult(); if (!CommandValidations.ValidateRequiredString(PerNummer, 11)) { commandValidationResult.AddValidationError(CommandValidations.GetRequiredStringValidationErrorMessage(nameof(PerNummer), PerNummer, 11)); } return(commandValidationResult); }
public void Validation1() { TextBox TB = new TextBox(); TB.Text = "Circle 50,50"; CommandValidations V = new CommandValidations(TB); bool exceptedResult = false; bool actualResult = V.IsCmdValid; Assert.AreEqual(exceptedResult, actualResult); }
public void CheckCmdLineValidation() { TextBox TB = new TextBox(); TB.Text = "moveto 60,40"; CommandValidations V = new CommandValidations(TB); bool expectedResult = true; bool actualResult; V.CheckCmdLineValidation(TB.Text); actualResult = V.IsSyntaxValid; Assert.AreEqual(expectedResult, actualResult); }
public void checkIfVariableDefinedTest() { String input; Boolean expectedOutcome; Boolean realOutcome; TextBox textbox = new TextBox(); input = "Radius = 20 \r\n Circle Radius"; expectedOutcome = true; textbox.Text = input; CommandValidations validation = new CommandValidations(textbox); validation.checkIfVariableDefined("radius"); realOutcome = validation.IsCmdValid; Assert.AreEqual(expectedOutcome, realOutcome); }
public void checkLoopAndIfValidation() { String input; Boolean expectedOutcome; Boolean realOutcome; TextBox textbox = new TextBox(); input = "counter = 5 \r\n If counter = 5 then \r\n radius = 100 \r\n Circle radius \r\n EndIf"; textbox.Text = input; expectedOutcome = true; CommandValidations validation = new CommandValidations(textbox); validation.CheckCmdLoopAndIfValidation(); realOutcome = validation.IsCmdValid; Assert.AreEqual(expectedOutcome, realOutcome); }