public void GroupedSuggestion_Create_ContainsGoodRegex2() { Scope scope = new Scope("a", "Name"); Suggestion s = new Suggestion(@"b", "desc"); GroupedSuggestionDecorator decorator = new GroupedSuggestionDecorator(s, scope); Assert.AreEqual(@"(?<Name>b)", decorator.RegexText); }
public void GroupedSuggestion_CreateWithNoScopeName_ReturnsOriginalRegex() { Scope unnamedScope = new Scope("a"); Suggestion s = new Suggestion(@"a", "desc"); GroupedSuggestionDecorator decorator = new GroupedSuggestionDecorator(s, unnamedScope); Assert.AreEqual(@"a", decorator.RegexText); }
public void Sugggest_ScopeWithNameAndGroupedSuggestion_DoesNotConvertsUnneedlessly() { Suggestion nonGroupedSuggestions = new Suggestion(".", "anything", 1000); Scope root = new Scope("abc", "RootName"); Scope inner = root.DefineInnerScope(1, 1); inner.Name = "Inner"; GroupedSuggestionDecorator grouped = new GroupedSuggestionDecorator(nonGroupedSuggestions, inner); inner.Suggestions.Add(grouped); Suggestion suggestion = suggest.Suggest(root)[0]; Assert.AreEqual(@"(?<RootName>^a$(?<Inner>.)^c$)", suggestion.RegexText); }
public void Sugggest_ScopeWithNameAndGroupedSuggestion_DoesNotConvertsUnneedlessly() { Suggestion nonGroupedSuggestions = new Suggestion(".", "anything", 1000); Scope root = new Scope("abc", "RootName"); Scope inner = root.DefineInnerScope(1, 1); inner.Name="Inner"; GroupedSuggestionDecorator grouped = new GroupedSuggestionDecorator(nonGroupedSuggestions,inner); inner.Suggestions.Add(grouped); Suggestion suggestion = suggest.Suggest(root)[0]; Assert.AreEqual(@"(?<RootName>^a$(?<Inner>.)^c$)", suggestion.RegexText); }