IGNITE-5224 .NET: PadLeft and PadRight support in LINQ
authorAlexey Popov <tank2.alex@gmail.com>
Fri, 6 Oct 2017 09:18:38 +0000 (12:18 +0300)
committerPavel Tupitsyn <ptupitsyn@apache.org>
Fri, 6 Oct 2017 09:18:38 +0000 (12:18 +0300)
This closes #2808

modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Strings.cs
modules/platforms/dotnet/Apache.Ignite.Linq/Impl/MethodVisitor.cs

index 7457d0a..1139c4d 100644 (file)
@@ -46,6 +46,11 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Linq
         {
             var strings = GetSecondPersonCache().AsCacheQueryable().Select(x => x.Value.Name);
 
+            CheckFunc(x => x.PadLeft(20), strings);
+            CheckFunc(x => x.PadLeft(20, 'l'), strings);
+            CheckFunc(x => x.PadRight(20), strings);
+            CheckFunc(x => x.PadRight(20, 'r'), strings);
+
             CheckFunc(x => x.ToLower(), strings);
             CheckFunc(x => x.ToUpper(), strings);
             CheckFunc(x => x.StartsWith("Person_9"), strings);
index 9446af3..8abf2a6 100644 (file)
@@ -66,6 +66,10 @@ namespace Apache.Ignite.Linq.Impl
             GetParameterizedTrimMethod("TrimStart", "ltrim"),
             GetParameterizedTrimMethod("TrimEnd", "rtrim"),
             GetStringMethod("Replace", "replace", typeof(string), typeof(string)),
+            GetStringMethod("PadLeft", "lpad", typeof (int)),
+            GetStringMethod("PadLeft", "lpad", typeof (int), typeof (char)),
+            GetStringMethod("PadRight", "rpad", typeof (int)),
+            GetStringMethod("PadRight", "rpad", typeof (int), typeof (char)),
 
             GetMethod(typeof (Regex), "Replace", new[] {typeof (string), typeof (string), typeof (string)}, 
                 GetFunc("regexp_replace")),