public void SingleStringTest()
 {
     string source = @"Foo eq 'Bar'";
     var target = new StringExtractor(source);
     Assert.AreEqual("Foo eq ?0", target.ModifedString);
     Assert.AreEqual("Bar", target.GetValue("?0"));
 }
 public void NothingButEscapedQuotesTest()
 {
     string source = @"Foo eq '\'\'\'\''";
     var target = new StringExtractor(source);
     Assert.AreEqual("Foo eq ?0", target.ModifedString);
     Assert.AreEqual(@"''''", target.GetValue("?0"));
 }
 public void EscapedQuoteTest()
 {
     string source = @"Foo eq 'B\'ar'";
     var target = new StringExtractor(source);
     Assert.AreEqual("Foo eq ?0", target.ModifedString);
     Assert.AreEqual(@"B'ar", target.GetValue("?0"));
 }
Пример #4
0
 public static IEnumerable<Tuple<PropertyReference, string>> GetNonEqExpressions(string index)
 {
     var strings = new StringExtractor(index);
     var fix = WhitespaceFixer.Fix(strings.ModifedString);
     return GetBlocksOfThree(fix)
         .Where(tuple => !tuple.Item2.Equals("eq", StringComparison.OrdinalIgnoreCase))
         .Select(tuple => Tuple.Create(new PropertyReference(tuple.Item1), tuple.Item3.StartsWith("?") ? strings.GetValue(tuple.Item3) : tuple.Item3));
 }
 public void TwoStringsTest()
 {
     string source = @"Foo eq 'Bar' and Quux eq 'Wibble'";
     var target = new StringExtractor(source);
     Assert.AreEqual("Foo eq ?0 and Quux eq ?1", target.ModifedString);
     Assert.AreEqual("Bar", target.GetValue("?0"));
     Assert.AreEqual("Wibble", target.GetValue("?1"));
 }
Пример #6
0
        public static IEnumerable <Tuple <PropertyReference, string> > GetNonEqExpressions(string index)
        {
            var strings = new StringExtractor(index);
            var fix     = WhitespaceFixer.Fix(strings.ModifedString);

            return(GetBlocksOfThree(fix)
                   .Where(tuple => !tuple.Item2.Equals("eq", StringComparison.OrdinalIgnoreCase))
                   .Select(tuple => Tuple.Create(new PropertyReference(tuple.Item1), tuple.Item3.StartsWith("?") ? strings.GetValue(tuple.Item3) : tuple.Item3)));
        }