@@ -2474,7 +2474,7 @@ ExpressionEvaluator evaluatorForMethodArgs()
2474
2474
. Returns ( typeof ( List < Regex > ) )
2475
2475
. SetCategory ( "Bug resolution" ) ;
2476
2476
2477
- // For bug #65
2477
+ #region For bug #65
2478
2478
var Persons = new List < Person2 > ( ) { new Person2 ( ) { Code = "QT00010" , Name = "Pedrito" , Number = 11.11m } ,
2479
2479
new Person2 ( ) { Code = "QT00011" , Name = "Pablito" , Number = 12.11m } } ;
2480
2480
@@ -2502,9 +2502,9 @@ ExpressionEvaluator evaluatorForMethodArgs()
2502
2502
. Returns ( 11.11m )
2503
2503
. SetCategory ( "Bug resolution" ) ;
2504
2504
2505
- // end of bug #65
2505
+ #endregion
2506
2506
2507
- // For Issue Manage nested class and enum #95
2507
+ #region For Issue Manage nested class and enum #95
2508
2508
2509
2509
yield return new TestCaseData ( new ExpressionEvaluator ( )
2510
2510
, "Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)"
@@ -2513,7 +2513,123 @@ ExpressionEvaluator evaluatorForMethodArgs()
2513
2513
. SetCategory ( "Bug resolution" )
2514
2514
. SetCategory ( "NestedType" ) ;
2515
2515
2516
- // end of issue #95
2516
+ yield return new TestCaseData ( new ExpressionEvaluator ( )
2517
+ , "Environment.GetFolderPath((Environment.SpecialFolder)5)"
2518
+ , null )
2519
+ . Returns ( Environment . GetFolderPath ( Environment . SpecialFolder . MyDocuments ) )
2520
+ . SetCategory ( "Bug resolution" )
2521
+ . SetCategory ( "NestedType" ) ;
2522
+
2523
+ yield return new TestCaseData ( new ExpressionEvaluator ( )
2524
+ , "new CodingSeb.ExpressionEvaluator.Tests.OtherNamespace.ClassInOtherNameSpace1.ANestedClass().Value1"
2525
+ , null )
2526
+ . Returns ( 45 )
2527
+ . SetCategory ( "Bug resolution" )
2528
+ . SetCategory ( "NestedType" ) ;
2529
+
2530
+ #endregion
2531
+
2532
+ #region For issue #98 Evaluate methods names as delegates
2533
+
2534
+ yield return new TestCaseData ( new ExpressionEvaluator ( )
2535
+ , "Array.ConvertAll(\" 1,2,3,4,5,6,-1\" .Split(','), Int32.Parse).Min()"
2536
+ , null )
2537
+ . Returns ( - 1 )
2538
+ . SetCategory ( "Bug resolution" )
2539
+ . SetCategory ( "MethodNameAsDelegates" ) ;
2540
+
2541
+ yield return new TestCaseData ( new ExpressionEvaluator ( )
2542
+ , "Array.ConvertAll<string,int>(\" 1,2,3,4,5,6,-1\" .Split(','), Int32.Parse).Min()"
2543
+ , null )
2544
+ . Returns ( - 1 )
2545
+ . SetCategory ( "Bug resolution" )
2546
+ . SetCategory ( "MethodNameAsDelegates" ) ;
2547
+
2548
+ yield return new TestCaseData ( new ExpressionEvaluator ( )
2549
+ , "Array.ConvertAll(\" 1,2,3,4,5,6,-1\" .Split(','), s => Int32.Parse(s)).Min()"
2550
+ , null )
2551
+ . Returns ( - 1 )
2552
+ . SetCategory ( "Bug resolution" )
2553
+ . SetCategory ( "MethodNameAsDelegates" ) ;
2554
+
2555
+ yield return new TestCaseData ( new ExpressionEvaluator ( )
2556
+ , "Array.ConvertAll<string, int>(\" 1,2,3,4,5,6,-1\" .Split(','), s => Int32.Parse(s)).Min()"
2557
+ , null )
2558
+ . Returns ( - 1 )
2559
+ . SetCategory ( "Bug resolution" )
2560
+ . SetCategory ( "MethodNameAsDelegates" ) ;
2561
+
2562
+ yield return new TestCaseData ( new ExpressionEvaluator ( )
2563
+ , "Array.ConvertAll(\" test for Upper\" .ToCharArray(), Char.IsUpper)"
2564
+ , null )
2565
+ . Returns ( Array . ConvertAll ( "test for Upper" . ToCharArray ( ) , Char . IsUpper ) )
2566
+ . SetCategory ( "Bug resolution" )
2567
+ . SetCategory ( "MethodNameAsDelegates" ) ;
2568
+
2569
+ //yield return new TestCaseData(new ExpressionEvaluator()
2570
+ // , "Array.ConvertAll(\"test for Upper\".ToCharArray(),u => u => Char.IsUpper(u) ? Char.ToLower(u) : Char.ToUpper(u))"
2571
+ // , null)
2572
+ // .Returns(Array.ConvertAll("test for Upper".ToCharArray(), u => Char.IsUpper(u) ? Char.ToLower(u) : Char.ToUpper(u)))
2573
+ // .SetCategory("Bug resolution")
2574
+ // .SetCategory("MethodNameAsDelegates");
2575
+
2576
+ yield return new TestCaseData ( new ExpressionEvaluator ( )
2577
+ , "(() => { var m = int.Parse; return m(\" 5\" ); })()"
2578
+ , null )
2579
+ . Returns ( 5 )
2580
+ . SetCategory ( "Bug resolution" )
2581
+ . SetCategory ( "MethodNameAsDelegates" ) ;
2582
+
2583
+ yield return new TestCaseData ( new ExpressionEvaluator ( )
2584
+ , "\" test for Upper\" .ToCharArray().First(Char.IsUpper)"
2585
+ , null )
2586
+ . Returns ( 'U' )
2587
+ . SetCategory ( "Bug resolution" )
2588
+ . SetCategory ( "MethodNameAsDelegates" ) ;
2589
+
2590
+ yield return new TestCaseData ( new ExpressionEvaluator ( )
2591
+ , "\" test for Upper\" .ToCharArray().First(Char.IsUpper)"
2592
+ , null )
2593
+ . Returns ( 'U' )
2594
+ . SetCategory ( "Bug resolution" )
2595
+ . SetCategory ( "MethodNameAsDelegates" ) ;
2596
+
2597
+ yield return new TestCaseData ( new ExpressionEvaluator ( )
2598
+ , "\" test for Upper\" .ToCharArray().First(c => Char.IsUpper(c))"
2599
+ , null )
2600
+ . Returns ( 'U' )
2601
+ . SetCategory ( "Bug resolution" )
2602
+ . SetCategory ( "MethodNameAsDelegates" ) ;
2603
+
2604
+ yield return new TestCaseData ( new ExpressionEvaluator ( )
2605
+ , "Array.Find(\" test for Upper\" .ToCharArray(), Char.IsUpper)"
2606
+ , null )
2607
+ . Returns ( 'U' )
2608
+ . SetCategory ( "Bug resolution" )
2609
+ . SetCategory ( "MethodNameAsDelegates" ) ;
2610
+
2611
+ yield return new TestCaseData ( new ExpressionEvaluator ( )
2612
+ , "Array.Find(\" test for Upper\" .ToCharArray(), c => Char.IsUpper(c))"
2613
+ , null )
2614
+ . Returns ( 'U' )
2615
+ . SetCategory ( "Bug resolution" )
2616
+ . SetCategory ( "MethodNameAsDelegates" ) ;
2617
+
2618
+ yield return new TestCaseData ( new ExpressionEvaluator ( )
2619
+ , "\" test for Upper\" .ToCharArray().Any(Char.IsUpper)"
2620
+ , null )
2621
+ . Returns ( true )
2622
+ . SetCategory ( "Bug resolution" )
2623
+ . SetCategory ( "MethodNameAsDelegates" ) ;
2624
+
2625
+ yield return new TestCaseData ( new ExpressionEvaluator ( )
2626
+ , "\" test for Upper\" .ToCharArray().ToList().First(Char.IsUpper)"
2627
+ , null )
2628
+ . Returns ( 'U' )
2629
+ . SetCategory ( "Bug resolution" )
2630
+ . SetCategory ( "MethodNameAsDelegates" ) ;
2631
+
2632
+ #endregion
2517
2633
2518
2634
#endregion
2519
2635
}
0 commit comments