コード例 #1
0
ファイル: AverageTests.cs プロジェクト: thiagodin/corefx
            // Type: long?, selector function is called
            public static int Test4g()
            {
                Data_Nlong[] source = new Data_Nlong[] { new Data_Nlong {
                                                             name = "Tim", num = 40L
                                                         },
                                                         new Data_Nlong {
                                                             name = "John", num = null
                                                         },
                                                         new Data_Nlong {
                                                             name = "Bob", num = 30L
                                                         } };
                double?expected = 35;

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

                return((expected == actual) ? 0 : 1);
            }
コード例 #2
0
ファイル: SumTests.cs プロジェクト: jmhardison/corefx
            // Type: long?, selector function is called
            public static int Test4g()
            {
                Data_Nlong[] source = new Data_Nlong[]{ new Data_Nlong{name="Tim", num=10L},
                                                new Data_Nlong{name="John", num=Int32.MaxValue},
                                                new Data_Nlong{name="Bob", num=null}
            };
                long expected = (long)Int32.MaxValue + 10;

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

                return ((expected == actual) ? 0 : 1);
            }
コード例 #3
0
ファイル: AverageTests.cs プロジェクト: jmhardison/corefx
            // Type: long?, selector function is called
            public static int Test4g()
            {
                Data_Nlong[] source = new Data_Nlong[]{ new Data_Nlong{name="Tim", num=40L},
                                                    new Data_Nlong{name="John", num=null},
                                                    new Data_Nlong{name="Bob", num=30L}
            };
                double? expected = 35;

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

                return ((expected == actual) ? 0 : 1);
            }
コード例 #4
0
ファイル: MaxTests.cs プロジェクト: jmhardison/corefx
            // Type: long?, selector function is called
            public static int Test4g()
            {
                Data_Nlong[] source = new Data_Nlong[]{ new Data_Nlong{name="Tim", num=null},
                                                new Data_Nlong{name="John", num=-105L},
                                                new Data_Nlong{name="Bob", num=Int64.MaxValue}
            };
                long? expected = Int64.MaxValue;

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

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