示例#1
0
        public bool CompareShouldBeAffectedIgnoreCase(string left, string right, bool ignoreCase)
        {
            var expression = Expression.Constant("");
            var result     = new PartialMatch <CustomEntity>(":", ignoreCase).Compare(expression, OperandBuilder.BuildUp(left), OperandBuilder.BuildUp(right));

            return((bool)Expression.Lambda(result.Expression).Compile().DynamicInvoke());
        }
示例#2
0
 public void SetupContext()
 {
     Matcher      = MethodMatcherTestHelper.GetMethodNameMatcher <MultiWordTestContext>("Foo");
     FoundMatches = Matcher.GetMatches("Foo Bar Baz");
     Partial      = FoundMatches.OfType <PartialMatch>().FirstOrDefault();
     Exact        = FoundMatches.OfType <ExactMatch>().FirstOrDefault();
 }
示例#3
0
 private static int ByteIndexOf(byte[] arrayToSearch, byte[] patternToFind)
 {
     if (((patternToFind.Length != 0) && (arrayToSearch.Length != 0)) && (arrayToSearch.Length >= patternToFind.Length))
     {
         List <PartialMatch> list = new List <PartialMatch>();
         for (int i = 0; i < arrayToSearch.Length; i++)
         {
             for (int j = list.Count - 1; j >= 0; j--)
             {
                 if (arrayToSearch[i] == patternToFind[list[j].MatchLength])
                 {
                     PartialMatch local1 = list[j];
                     local1.MatchLength++;
                     if (list[j].MatchLength == patternToFind.Length)
                     {
                         return(list[j].Index);
                     }
                 }
                 else
                 {
                     list.Remove(list[j]);
                 }
             }
             if (arrayToSearch[i] == patternToFind[0])
             {
                 if (patternToFind.Length == 1)
                 {
                     return(i);
                 }
                 list.Add(new PartialMatch(i));
             }
         }
     }
     return(-1);
 }
示例#4
0
        private IEnumerable <InvocationChain> GetChainsFromPartialMatch(PartialMatch partialMatch, string line)
        {
            var partialChain = new InvocationChain(BuildInvocation(partialMatch.MemberInfo, partialMatch));

            var matchedText   = partialChain.Invocations.Last().MatchedText;
            var remainingLine = line.Substring(matchedText.Length).Trim();

            return(TryToRecursivelyExtendPartialMatch(partialChain, remainingLine, partialMatch));
        }
示例#5
0
        public void GenericTypeTest()
        {
            var patt = typeof(ISqlSelect <RewriteTypes.C1>);
            var expr = typeof(Fluent.ISqlGroupByAble <Cliente, Factura, object>);

            var ret = PartialMatch.FromType(patt, expr);

            Assert.AreEqual(1, ret.Types.Count);
            Assert.AreEqual(typeof(Factura), ret.Types[typeof(RewriteTypes.C1)]);
        }
示例#6
0
        private IEnumerable <InvocationChain> TryToRecursivelyExtendPartialMatch(InvocationChain chain, string remainingLine,
                                                                                 PartialMatch partial)
        {
            if (partial.TerminatingType == null)
            {
                yield break;
            }
            var chainedMapper = _factory.GetInterpreterForType(partial.TerminatingType);

            foreach (var childChain in chainedMapper.GetChains(remainingLine))
            {
                var union = chain.Invocations.Union(childChain.Invocations);

                yield return(new InvocationChain(union.ToArray()));
            }
        }
示例#7
0
        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 bool CompareShouldBeAffectedIgnoreCase(string left, string right, bool ignoreCase)
 {
     var expression = Expression.Constant("");
     var result = new PartialMatch<CustomEntity>(":", ignoreCase).Compare(expression, OperandBuilder.BuildUp(left), OperandBuilder.BuildUp(right));
     return (bool)Expression.Lambda(result.Expression).Compile().DynamicInvoke();
 }
 public void SetUp()
 {
     testee = new PartialMatch<CustomEntity>(":");
 }
示例#10
0
 public void SetUp()
 {
     testee = new PartialMatch <CustomEntity>(":");
 }