Example #1
0
        public void ValidateWith_ShouldReturnTrue(string queryToValidate)
        {
            QueryValidator validator = new QueryValidator();
            bool           result    = validator.ValidateQuery(queryToValidate);

            Assert.True(result);
        }
Example #2
0
        public void ValidateQuery_ShouldReturnTrue(string queryToValidate)
        {
            QueryValidator validator = new QueryValidator();
            bool           result    = validator.ValidateQuery(queryToValidate);

            Assert.True(result, $"{queryToValidate} should return true");
        }
Example #3
0
        public void ValidateQuery_SelectSuchThat_InvalidQueries(string queryToValidate)
        {
            QueryValidator validator = new QueryValidator();
            var            result    = validator.ValidateQuery(queryToValidate);

            Assert.True(result);
        }
Example #4
0
        public void ValidateQuery_ShouldReturnTrue_WhenTheSameVariablesDefinedWithLowerAndUpperCase()
        {
            // Can we declare lower and uppercase? (Compare with how PipeTester works)
            QueryValidator validator = new QueryValidator();
            bool           result    = validator.ValidateQuery("Procedure p; While P; Select P");

            Assert.True(result);
        }
Example #5
0
        public void ValidateSelectBoolean_ShouldReturnFalse_WhenModifiesIsAmbiguous()
        {
            // Use of underscore must not lead to ambiguities. For example, the following query should be rejected
            // as incorrect as it is not clear if underscore refers to a statement or to a procedure
            QueryValidator validator = new QueryValidator();
            bool           result    = validator.ValidateQuery("select boolean such that Modifies (_, \"x\")");

            Assert.False(result);
        }
Example #6
0
        public void ValidateQuery_ShouldReturnFalse_WhenTheSameVariablesAreDefined()
        {
            // arrange
            QueryValidator validator = new QueryValidator();
            // act
            Action act = () => validator.ValidateQuery("Procedure p; While p; Select p");

            // assert
            Assert.Throws <InvalidQueryException>(act);
        }
Example #7
0
        public void ValidateQuery_ShouldReturnFalse_WhenNotExistingDeclarationIsUsed(string queryToValidate)
        {
            // arrange
            QueryValidator validator = new QueryValidator();
            // act
            Action act = () => validator.ValidateQuery(queryToValidate);

            // assert
            Assert.Throws <InvalidQueryException>(act);
        }