Example #1
0
            // Type: float?, selector function is called
            public static int Test10g()
            {
                Data_Nfloat[] source = new Data_Nfloat[] { new Data_Nfloat {
                                                               name = "Tim", num = 5.5f
                                                           },
                                                           new Data_Nfloat {
                                                               name = "John", num = 15.5f
                                                           },
                                                           new Data_Nfloat {
                                                               name = "Bob", num = null
                                                           } };
                float?expected = 10.5f;

                var actual = source.Average((e) => e.num);

                return((expected == actual) ? 0 : 1);
            }
Example #2
0
            // Type: float?, selector function is called
            public static int Test10g()
            {
                Data_Nfloat[] source = new Data_Nfloat[]{ new Data_Nfloat{name="Tim", num=9.5f},
                                                new Data_Nfloat{name="John", num=null},
                                                new Data_Nfloat{name="Bob", num=8.5f}
            };
                float? expected = 18.0f;

                var actual = source.Sum((e) => e.num);

                return ((expected == actual) ? 0 : 1);
            }
Example #3
0
            // Type: float?, selector function is called
            public static int Test10g()
            {
                Data_Nfloat[] source = new Data_Nfloat[]{     new Data_Nfloat{name="Tim", num=5.5f},
                                                          new Data_Nfloat{name="John", num=15.5f},
                                                          new Data_Nfloat{name="Bob", num=null}
            };
                float? expected = 10.5f;

                var actual = source.Average((e) => e.num);

                return ((expected == actual) ? 0 : 1);
            }
Example #4
0
            // Type: float?, selector function is called
            public static int Test11g()
            {
                Data_Nfloat[] source = new Data_Nfloat[]{ new Data_Nfloat{name="Tim", num=40.5f},
                                                new Data_Nfloat{name="John", num=null},
                                                new Data_Nfloat{name="Bob", num=100.45f}
            };
                float? expected = 100.45f;

                var actual = source.Max((e) => e.num);

                return ((expected == actual) ? 0 : 1);
            }