public override bool Check(string query) { var arguments = CreateUtils.GetArgumentsFromQuery(query); var columns = CreateUtils.GetColumnsFromArguments(arguments); if (!columns.All(x => x.Length == 2)) { throw new MalformedColumnsException(); } foreach (var column in columns) { if (!GeneralUtils.ContainsOnlyAlphaNumericCharacters(column[0])) { throw new ForbiddenCharactersException(column[0]); } if (column[0].ToLower() == "id") { throw new ForbiddenColumnNameException(column[0]); } } return(this.CheckNext(query)); }
public void ContainsOnlyAlphaNumericCharacters_StringDoesNotContainOnlyAlphaNumericCharacters_ShouldReturnFalse(string value) { var acutal = GeneralUtils.ContainsOnlyAlphaNumericCharacters(value); Assert.False(acutal); }
public void ContainsOnlyAlphaNumericCharacters_StringContainsOnlyAlphaNumericCharacters_ShouldReturnTrue(string value) { var acutal = GeneralUtils.ContainsOnlyAlphaNumericCharacters(value); Assert.True(acutal); }