public void ValidateDeclarations_ShouldReturnFalse_WhenVariableMissing() { DeclarationValidator validator = new DeclarationValidator(); bool result = validator.ValidateDeclarationQuery("while "); Assert.False(result); }
public void ValidateDeclarations_ShouldReturnFalse_WhenKeywordsUsedAsVariable(string queryToValidate) { DeclarationValidator validator = new DeclarationValidator(); bool result = validator.ValidateDeclarationQuery(queryToValidate); Assert.False(result, $"{queryToValidate} contains keyword as variable"); }
public void ValidateDeclarations_ShouldReturnFalse_WhenIncorrectVariableName(string queryToValidate) { DeclarationValidator validator = new DeclarationValidator(); bool result = validator.ValidateDeclarationQuery(queryToValidate); Assert.False(result, $"{queryToValidate} should be in format: LETTER ( LETTER | DIGIT | ‘#’ )* "); }
public void ValidateDeclarations_ShouldReturnTrue(string queryToValidate) { DeclarationValidator validator = new DeclarationValidator(); bool result = validator.ValidateDeclarationQuery(queryToValidate); Assert.True(result, $"{queryToValidate} should return true"); }
public void ValidateDeclarations_ShouldReturnFalse_WhenIncorrectDesignEntity(string queryToValidate) { DeclarationValidator validator = new DeclarationValidator(); bool result = validator.ValidateDeclarationQuery(queryToValidate); Assert.False(result, $"{queryToValidate} have incorrect synonyms. " + $"Valid synonyms are ‘procedure’ | ‘stmtLst’ | ‘stmt’ | ‘assign’ | ‘call’ | ‘while’ " + $"| ‘if’ | ‘variable’ | ‘constant’| ‘prog_line’ "); }
public QueryValidator() { DeclarationValidator = new DeclarationValidator(); }