public void SetupContext() { var matcher = new RegexMatcher("^Some fake method name", typeof(RegexTestContext).GetMethod("MethodWithReturnValue")); TestText = "Some fake method name"; TestMatch = matcher.GetMatch(TestText); }
public void SetupContext() { var matcher = new RegexMatcher("^Some fake method name (.+)", typeof(RegexTestContext).GetMethod("MethodWithParams")); TestText = "Some fake method name and some other text"; TestMatch = matcher.GetMatch(TestText); }
public Item(AnimeWishlist.Item item) { _anime = new Regex(item.Name, RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnoreCase); _excluding = item.Excluding == null ? default : new NameMatch(new CharacterWishlist { Items = new List <CharacterWishlist.Item>(item.Excluding) }); }
private Invocation BuildInvocation(MemberInfo memberInfo, NameMatch currentMatch) { if (memberInfo is MethodInfo) { return(new Invocation(memberInfo, BuildParamValues((MethodInfo)memberInfo, currentMatch.ParamValues), BuildRawParamValues((MethodInfo)memberInfo, currentMatch.ParamValues), currentMatch.MatchedText)); } return(new Invocation(memberInfo, new string[0], new string[0], currentMatch.MatchedText)); }
void ResetNameMatch(CharacterWishlist wishlist) { try { _name = new NameMatch(wishlist); _logger.LogDebug($"Loaded character wishlist: {JsonConvert.SerializeObject(wishlist)}"); } catch (Exception e) { _name = default; _logger.LogWarning(e, "Could not build character match."); } }
public Item(UserWishlistList.Item item) { _excludingCharacters = item.ExcludingCharacters == null ? default : new NameMatch(new CharacterWishlist { Items = new List <CharacterWishlist.Item>(item.ExcludingCharacters) }); _excludingAnime = item.ExcludingAnime == null ? default : new AnimeMatch(new AnimeWishlist { Items = new List <AnimeWishlist.Item>(item.ExcludingAnime) }); }
public NameMatch GetMatch(string line) { var result = _regex.Match(line); NameMatch match = null; if (result.Success) { if (result.Length == line.Length) { match = new ExactMatch(GetParameters(result), line); } else if (PartialMatchSupportedByMember()) { match = new PartialMatch(MemberInfo, GetParameters(result), result.Value, line.Substring(result.Length).Trim()); } } if (match != null) { DebugTrace.Trace("RegExp match", "Member = " + MemberInfo.DeclaringType.Name + "." + MemberInfo.Name); } return(match); }
public void Should_parse_param() { FoundMatch = GetMatch("Test parsing of foo"); FoundMatch.ParamValues["enumValue"].ShouldEqual(MatchingTest.Foo); }
public void Should_be_exact_match() { FoundMatch = GetMatch("Test parsing of foo"); FoundMatch.ShouldBeOfType <ExactMatch>(); }
public void Should_match_multiple_words_in_enum_name() { FoundMatch = GetMatch("Test parsing of foobar baz"); FoundMatch.ParamValues["enumValue"].ShouldEqual(MatchingTest.FoobarBaz); }
public void SetupContext() { var matcher = new RegexMatcher("^Some fake method name", null); TestMatch = matcher.GetMatch("this does not match"); }