Beispiel #1
0
        public void Suggest_RootSuggestionsAttachedCorrectly()
        {
            Scope root  = new Scope("abc", "Root");
            Scope inner = root.DefineInnerScope(1, 1);

            inner.Name = "Inner";


            Suggestion simple = new Suggestion(".", "anything");
            UnNamedGroupedSuggestionDecorator grouped = new UnNamedGroupedSuggestionDecorator(simple, inner);

            inner.Suggestions.Add(grouped);

            suggest.UseGroupsForUnnamedScopes = true;
            Suggestion suggestion = suggest.Suggest(root)[0];

            Assert.IsTrue(root.Suggestions.Count > 0);
        }
Beispiel #2
0
        public void UseGroupsForUnNamedScopes_GroupedSuggestionExists2ndPass_DoesNotNestGroupInItselfLeftNameworks()
        {
            Scope root  = new Scope("abc");
            Scope inner = root.DefineInnerScope(1, 1);

            inner.Name = "Inner";
            Suggestion simple = new Suggestion(".", "anything");
            UnNamedGroupedSuggestionDecorator grouped = new UnNamedGroupedSuggestionDecorator(simple, inner);

            inner.Suggestions.Add(grouped);

            suggest.UseGroupsForUnnamedScopes = true;
            Suggestion suggestion = suggest.Suggest(root)[0];

            root.InnerLeftScope.Name = "left";
            suggestion = suggest.Suggest(root)[0];
            Assert.AreEqual(@"(?<Root>(?<left>^a$)(?<Inner>.)(^c$))", suggestion.RegexText);
        }
        public void UseGroupsForUnNamedScopes_GroupedSuggestionExists2ndPass_DoesNotNestGroupInItselfLeftNameworks()
        {
            Scope root = new Scope("abc");
            Scope inner = root.DefineInnerScope(1, 1);
            inner.Name = "Inner";
            Suggestion simple = new Suggestion(".", "anything");
            UnNamedGroupedSuggestionDecorator grouped = new UnNamedGroupedSuggestionDecorator(simple,inner);
            inner.Suggestions.Add(grouped);

            suggest.UseGroupsForUnnamedScopes = true;
            Suggestion suggestion = suggest.Suggest(root)[0];

            root.InnerLeftScope.Name = "left";
            suggestion = suggest.Suggest(root)[0];
            Assert.AreEqual(@"(?<Root>(?<left>^a$)(?<Inner>.)(^c$))",suggestion.RegexText);
        }
        public void Suggest_RootSuggestionsAttachedCorrectly()
        {
            Scope root = new Scope("abc","Root");
            Scope inner = root.DefineInnerScope(1, 1);
            inner.Name = "Inner";

            Suggestion simple = new Suggestion(".", "anything");
            UnNamedGroupedSuggestionDecorator grouped = new UnNamedGroupedSuggestionDecorator(simple,inner);
            inner.Suggestions.Add(grouped);

            suggest.UseGroupsForUnnamedScopes = true;
            Suggestion suggestion = suggest.Suggest(root)[0];
            Assert.IsTrue(root.Suggestions.Count>0);
        }