Ejemplo n.º 1
0
        public void CanParseMultipleCategoriesWithAndPUT([PexAssumeUnderTest] CategoryExpression expr)
        {
            //CategoryExpression expr = new CategoryExpression("One + Two+Three");
            AndFilter andFilter = (AndFilter)expr.Filter;

            String[] tokens = expr.GetToken().Split('|');
            PexAssert.AreEqual(tokens.Length, andFilter.Filters.Length);
            for (int i = 0; i < andFilter.Filters.Length; i++)
            {
                CategoryFilter catFilter = (CategoryFilter)andFilter.Filters[i];
                PexAssert.AreEqual(catFilter.Categories, tokens[i]);
            }
        }
Ejemplo n.º 2
0
        public void CanParseMultipleAlternativesPUT([PexAssumeUnderTest] CategoryExpression expr)
        {
            // CategoryExpression expr = new CategoryExpression("One|Two|Three");
            OrFilter orFilter = (OrFilter)expr.Filter;

            char[]   orSeperator = { '|' };
            String[] tokens      = expr.GetToken().Split(orSeperator);
            PexAssert.AreEqual(tokens.Length, orFilter.Filters.Length);

            for (int i = 0; i < orFilter.Filters.Length; i++)
            {
                CategoryFilter catFilter = (CategoryFilter)orFilter.Filters[i];
                PexAssert.AreEqual(catFilter.Categories, tokens[i]);
            }
        }
Ejemplo n.º 3
0
        public void CombinedPUT([PexAssumeUnderTest] CategoryExpression expr)
        {
            AndFilter andFilter = (AndFilter)expr.Filter;
            String    token     = expr.GetToken();

            String[] seperator    = { "+", "-" };
            String[] tokens_split = token.Split(seperator, 10, StringSplitOptions.None);
            PexAssert.AreEqual(tokens_split.Length, andFilter.Filters.Length);
            List <String> list = new List <String>();

            char[]   plus             = { '+' };
            String[] tokens_withMinus = token.Split(plus);
            char[]   minus            = { '-' };
            for (int i = 0; i < tokens_withMinus.Length; i++)
            {
                //"A+B-C"
                if (tokens_withMinus[i].Contains("-"))
                {
                    String[] subTokens = tokens_withMinus[i].Split(minus);
                    for (int j = 1; j < subTokens.Length; j++)
                    {
                        PexAssert.AreEqual(subTokens[j], typeof(NotFilter));
                    }
                }
            }

            String[] tokens_withPlus = token.Split(minus);
            for (int i = 0; i < tokens_withMinus.Length; i++)
            {
                //"A+B-C"
                if (tokens_withMinus[i].Contains("+"))
                {
                    String[] subTokens = tokens_withMinus[i].Split(plus);
                    for (int j = 1; j < subTokens.Length; j++)
                    {
                        PexAssert.AreEqual(subTokens[j], typeof(CategoryFilter));
                    }
                }
            }
        }