@@ -2597,25 +2597,29 @@ ExpressionEvaluator evaluatorForMethodArgs()
25972597 , "Persons.Sum(x=>x.Number)"
25982598 , null )
25992599 . Returns ( 23.22m )
2600- . SetCategory ( "Bug resolution" ) ;
2600+ . SetCategory ( "Bug resolution" )
2601+ . SetCategory ( "#65" ) ;
26012602
26022603 yield return new TestCaseData ( new ExpressionEvaluator ( ) { Context = new { Persons } }
26032604 , "Persons.Average(x=>x.Number)"
26042605 , null )
26052606 . Returns ( 11.61m )
2606- . SetCategory ( "Bug resolution" ) ;
2607+ . SetCategory ( "Bug resolution" )
2608+ . SetCategory ( "#65" ) ;
26072609
26082610 yield return new TestCaseData ( new ExpressionEvaluator ( ) { Context = new { Persons } }
26092611 , "Persons.Max(x=>x.Number)"
26102612 , null )
26112613 . Returns ( 12.11m )
2612- . SetCategory ( "Bug resolution" ) ;
2614+ . SetCategory ( "Bug resolution" )
2615+ . SetCategory ( "#65" ) ;
26132616
26142617 yield return new TestCaseData ( new ExpressionEvaluator ( ) { Context = new { Persons } }
26152618 , "Persons.Min(x=>x.Number)"
26162619 , null )
26172620 . Returns ( 11.11m )
2618- . SetCategory ( "Bug resolution" ) ;
2621+ . SetCategory ( "Bug resolution" )
2622+ . SetCategory ( "#65" ) ;
26192623
26202624 #endregion
26212625
@@ -2626,20 +2630,23 @@ ExpressionEvaluator evaluatorForMethodArgs()
26262630 , null )
26272631 . Returns ( Environment . GetFolderPath ( Environment . SpecialFolder . CommonApplicationData ) )
26282632 . SetCategory ( "Bug resolution" )
2633+ . SetCategory ( "#95" )
26292634 . SetCategory ( "NestedType" ) ;
26302635
26312636 yield return new TestCaseData ( new ExpressionEvaluator ( )
26322637 , "Environment.GetFolderPath((Environment.SpecialFolder)5)"
26332638 , null )
26342639 . Returns ( Environment . GetFolderPath ( Environment . SpecialFolder . MyDocuments ) )
26352640 . SetCategory ( "Bug resolution" )
2641+ . SetCategory ( "#95" )
26362642 . SetCategory ( "NestedType" ) ;
26372643
26382644 yield return new TestCaseData ( new ExpressionEvaluator ( )
26392645 , "new CodingSeb.ExpressionEvaluator.Tests.OtherNamespace.ClassInOtherNameSpace1.ANestedClass().Value1"
26402646 , null )
26412647 . Returns ( 45 )
26422648 . SetCategory ( "Bug resolution" )
2649+ . SetCategory ( "#95" )
26432650 . SetCategory ( "NestedType" ) ;
26442651
26452652 #endregion
@@ -2651,97 +2658,103 @@ ExpressionEvaluator evaluatorForMethodArgs()
26512658 , null )
26522659 . Returns ( - 1 )
26532660 . SetCategory ( "Bug resolution" )
2661+ . SetCategory ( "#95" )
26542662 . SetCategory ( "MethodNameAsDelegates" ) ;
26552663
26562664 yield return new TestCaseData ( new ExpressionEvaluator ( )
26572665 , "Array.ConvertAll<string,int>(\" 1,2,3,4,5,6,-1\" .Split(','), Int32.Parse).Min()"
26582666 , null )
26592667 . Returns ( - 1 )
26602668 . SetCategory ( "Bug resolution" )
2669+ . SetCategory ( "#95" )
26612670 . SetCategory ( "MethodNameAsDelegates" ) ;
26622671
26632672 yield return new TestCaseData ( new ExpressionEvaluator ( )
26642673 , "Array.ConvertAll(\" 1,2,3,4,5,6,-1\" .Split(','), s => Int32.Parse(s)).Min()"
26652674 , null )
26662675 . Returns ( - 1 )
26672676 . SetCategory ( "Bug resolution" )
2677+ . SetCategory ( "#95" )
26682678 . SetCategory ( "MethodNameAsDelegates" ) ;
26692679
26702680 yield return new TestCaseData ( new ExpressionEvaluator ( )
26712681 , "Array.ConvertAll<string, int>(\" 1,2,3,4,5,6,-1\" .Split(','), s => Int32.Parse(s)).Min()"
26722682 , null )
26732683 . Returns ( - 1 )
26742684 . SetCategory ( "Bug resolution" )
2685+ . SetCategory ( "#95" )
26752686 . SetCategory ( "MethodNameAsDelegates" ) ;
26762687
26772688 yield return new TestCaseData ( new ExpressionEvaluator ( )
26782689 , "Array.ConvertAll(\" test for Upper\" .ToCharArray(), Char.IsUpper)"
26792690 , null )
26802691 . Returns ( Array . ConvertAll ( "test for Upper" . ToCharArray ( ) , Char . IsUpper ) )
26812692 . SetCategory ( "Bug resolution" )
2693+ . SetCategory ( "#95" )
26822694 . SetCategory ( "MethodNameAsDelegates" ) ;
26832695
2684- //yield return new TestCaseData(new ExpressionEvaluator()
2685- // , "Array.ConvertAll(\"test for Upper\".ToCharArray(),u => u => Char.IsUpper(u) ? Char.ToLower(u) : Char.ToUpper(u))"
2686- // , null)
2687- // .Returns(Array.ConvertAll("test for Upper".ToCharArray(), u => Char.IsUpper(u) ? Char.ToLower(u) : Char.ToUpper(u)))
2688- // .SetCategory("Bug resolution")
2689- // .SetCategory("MethodNameAsDelegates");
2690-
26912696 yield return new TestCaseData ( new ExpressionEvaluator ( )
26922697 , "(() => { var m = int.Parse; return m(\" 5\" ); })()"
26932698 , null )
26942699 . Returns ( 5 )
26952700 . SetCategory ( "Bug resolution" )
2701+ . SetCategory ( "#95" )
26962702 . SetCategory ( "MethodNameAsDelegates" ) ;
26972703
26982704 yield return new TestCaseData ( new ExpressionEvaluator ( )
26992705 , "\" test for Upper\" .ToCharArray().First(Char.IsUpper)"
27002706 , null )
27012707 . Returns ( 'U' )
27022708 . SetCategory ( "Bug resolution" )
2709+ . SetCategory ( "#95" )
27032710 . SetCategory ( "MethodNameAsDelegates" ) ;
27042711
27052712 yield return new TestCaseData ( new ExpressionEvaluator ( )
27062713 , "\" test for Upper\" .ToCharArray().First(Char.IsUpper)"
27072714 , null )
27082715 . Returns ( 'U' )
27092716 . SetCategory ( "Bug resolution" )
2717+ . SetCategory ( "#95" )
27102718 . SetCategory ( "MethodNameAsDelegates" ) ;
27112719
27122720 yield return new TestCaseData ( new ExpressionEvaluator ( )
27132721 , "\" test for Upper\" .ToCharArray().First(c => Char.IsUpper(c))"
27142722 , null )
27152723 . Returns ( 'U' )
27162724 . SetCategory ( "Bug resolution" )
2725+ . SetCategory ( "#95" )
27172726 . SetCategory ( "MethodNameAsDelegates" ) ;
27182727
27192728 yield return new TestCaseData ( new ExpressionEvaluator ( )
27202729 , "Array.Find(\" test for Upper\" .ToCharArray(), Char.IsUpper)"
27212730 , null )
27222731 . Returns ( 'U' )
27232732 . SetCategory ( "Bug resolution" )
2733+ . SetCategory ( "#95" )
27242734 . SetCategory ( "MethodNameAsDelegates" ) ;
27252735
27262736 yield return new TestCaseData ( new ExpressionEvaluator ( )
27272737 , "Array.Find(\" test for Upper\" .ToCharArray(), c => Char.IsUpper(c))"
27282738 , null )
27292739 . Returns ( 'U' )
27302740 . SetCategory ( "Bug resolution" )
2741+ . SetCategory ( "#95" )
27312742 . SetCategory ( "MethodNameAsDelegates" ) ;
27322743
27332744 yield return new TestCaseData ( new ExpressionEvaluator ( )
27342745 , "\" test for Upper\" .ToCharArray().Any(Char.IsUpper)"
27352746 , null )
27362747 . Returns ( true )
27372748 . SetCategory ( "Bug resolution" )
2749+ . SetCategory ( "#95" )
27382750 . SetCategory ( "MethodNameAsDelegates" ) ;
27392751
27402752 yield return new TestCaseData ( new ExpressionEvaluator ( )
27412753 , "\" test for Upper\" .ToCharArray().ToList().First(Char.IsUpper)"
27422754 , null )
27432755 . Returns ( 'U' )
27442756 . SetCategory ( "Bug resolution" )
2757+ . SetCategory ( "#95" )
27452758 . SetCategory ( "MethodNameAsDelegates" ) ;
27462759
27472760 #endregion
@@ -2752,48 +2765,56 @@ ExpressionEvaluator evaluatorForMethodArgs()
27522765 , "typeof(double[])"
27532766 , null )
27542767 . Returns ( typeof ( double [ ] ) )
2768+ . SetCategory ( "#100" )
27552769 . SetCategory ( "Bug resolution" ) ;
27562770
27572771 yield return new TestCaseData ( new ExpressionEvaluator ( )
27582772 , "typeof(double[ ])"
27592773 , null )
27602774 . Returns ( typeof ( double [ ] ) )
2775+ . SetCategory ( "#100" )
27612776 . SetCategory ( "Bug resolution" ) ;
27622777
27632778 yield return new TestCaseData ( new ExpressionEvaluator ( )
27642779 , "typeof(double[][])"
27652780 , null )
27662781 . Returns ( typeof ( double [ ] [ ] ) )
2782+ . SetCategory ( "#100" )
27672783 . SetCategory ( "Bug resolution" ) ;
27682784
27692785 yield return new TestCaseData ( new ExpressionEvaluator ( )
27702786 , "typeof(double[,])"
27712787 , null )
27722788 . Returns ( typeof ( double [ , ] ) )
2789+ . SetCategory ( "#100" )
27732790 . SetCategory ( "Bug resolution" ) ;
27742791
27752792 yield return new TestCaseData ( new ExpressionEvaluator ( )
27762793 , "typeof(int[])"
27772794 , null )
27782795 . Returns ( typeof ( int [ ] ) )
2796+ . SetCategory ( "#100" )
27792797 . SetCategory ( "Bug resolution" ) ;
27802798
27812799 yield return new TestCaseData ( new ExpressionEvaluator ( )
27822800 , "typeof(Int32[])"
27832801 , null )
27842802 . Returns ( typeof ( Int32 [ ] ) )
2803+ . SetCategory ( "#100" )
27852804 . SetCategory ( "Bug resolution" ) ;
27862805
27872806 yield return new TestCaseData ( new ExpressionEvaluator ( )
27882807 , "typeof(string[])"
27892808 , null )
27902809 . Returns ( typeof ( string [ ] ) )
2810+ . SetCategory ( "#100" )
27912811 . SetCategory ( "Bug resolution" ) ;
27922812
27932813 yield return new TestCaseData ( new ExpressionEvaluator ( )
27942814 , "typeof(Regex[])"
27952815 , null )
27962816 . Returns ( typeof ( Regex [ ] ) )
2817+ . SetCategory ( "#100" )
27972818 . SetCategory ( "Bug resolution" ) ;
27982819
27992820 yield return new TestCaseData ( new ExpressionEvaluator ( new ObjectContainer ( )
@@ -2803,6 +2824,41 @@ ExpressionEvaluator evaluatorForMethodArgs()
28032824 , "(double[])AnObjectProperty"
28042825 , null )
28052826 . Returns ( new double [ ] { 1.1 , 2.3 , 4.3 } )
2827+ . SetCategory ( "#100" )
2828+ . SetCategory ( "Bug resolution" ) ;
2829+
2830+ #endregion
2831+
2832+ #region for issue #110 OptionForceIntegerNumbersEvaluationsAsDoubleByDefault leads to exception when dividing
2833+
2834+ yield return new TestCaseData ( new ExpressionEvaluator ( )
2835+ {
2836+ OptionForceIntegerNumbersEvaluationsAsDoubleByDefault = true ,
2837+ }
2838+ , "3/Math.Round(Avg(1,2),MidpointRounding.AwayFromZero)"
2839+ , null )
2840+ . Returns ( 1.5d )
2841+ . SetCategory ( "#110" )
2842+ . SetCategory ( "Bug resolution" ) ;
2843+
2844+ yield return new TestCaseData ( new ExpressionEvaluator ( )
2845+ {
2846+ OptionForceIntegerNumbersEvaluationsAsDoubleByDefault = true ,
2847+ }
2848+ , "Math.Round(1.5,MidpointRounding.AwayFromZero)"
2849+ , null )
2850+ . Returns ( 2d )
2851+ . SetCategory ( "#110" )
2852+ . SetCategory ( "Bug resolution" ) ;
2853+
2854+ yield return new TestCaseData ( new ExpressionEvaluator ( )
2855+ {
2856+ OptionForceIntegerNumbersEvaluationsAsDoubleByDefault = true ,
2857+ }
2858+ , "Avg(1,2)"
2859+ , null )
2860+ . Returns ( 1.5d )
2861+ . SetCategory ( "#110" )
28062862 . SetCategory ( "Bug resolution" ) ;
28072863
28082864 #endregion
0 commit comments