Ejemplo n.º 1
0
            // Type: double?, selector function is called
            public static int Test6h()
            {
                Data_Ndouble[] source = new Data_Ndouble[] { new Data_Ndouble {
                                                                 name = "Tim", num = 5.5
                                                             },
                                                             new Data_Ndouble {
                                                                 name = "John", num = 15.5
                                                             },
                                                             new Data_Ndouble {
                                                                 name = "Bob", num = null
                                                             } };
                double?expected = 10.5;

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

                return((expected == actual) ? 0 : 1);
            }
Ejemplo n.º 2
0
            // Type: double?, selector function is called
            public static int Test6g()
            {
                Data_Ndouble[] source = new Data_Ndouble[]{ new Data_Ndouble{name="Tim", num=9.5},
                                                new Data_Ndouble{name="John", num=null},
                                                new Data_Ndouble{name="Bob", num=8.5}
            };
                double? expected = 18.0;

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

                return ((expected == actual) ? 0 : 1);
            }
Ejemplo n.º 3
0
            // Type: double?, selector function is called
            public static int Test6h()
            {
                Data_Ndouble[] source = new Data_Ndouble[]{ new Data_Ndouble{name="Tim", num=5.5},
                                                        new Data_Ndouble{name="John", num=15.5},
                                                        new Data_Ndouble{name="Bob", num=null}
            };
                double? expected = 10.5;

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

                return ((expected == actual) ? 0 : 1);
            }
Ejemplo n.º 4
0
            // Type: double?, selector function is called
            public static int Test6g()
            {
                Data_Ndouble[] source = new Data_Ndouble[]{ new Data_Ndouble{name="Tim", num=40.5},
                                                new Data_Ndouble{name="John", num=null},
                                                new Data_Ndouble{name="Bob", num=100.45}
            };
                double expected = 100.45;

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

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