예제 #1
0
        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));
        }
예제 #2
0
        public void ContainsOnlyAlphaNumericCharacters_StringDoesNotContainOnlyAlphaNumericCharacters_ShouldReturnFalse(string value)
        {
            var acutal = GeneralUtils.ContainsOnlyAlphaNumericCharacters(value);

            Assert.False(acutal);
        }
예제 #3
0
        public void ContainsOnlyAlphaNumericCharacters_StringContainsOnlyAlphaNumericCharacters_ShouldReturnTrue(string value)
        {
            var acutal = GeneralUtils.ContainsOnlyAlphaNumericCharacters(value);

            Assert.True(acutal);
        }