Ejemplo n.º 1
0
        private static IEnumerable<Student> GenerateRandomStudents(int count)
        {
            for (int i = 0; i < count; i++)
            {
                var random = new Random();
                var marks = Enumerable
                            .Repeat<Func<int, int, int>>(random.Next, 7)
                            .Select(rnd => rnd(2, 7));

                var grade = Enumerable
                            .Repeat<Func<int, int, int>>(random.Next, 1)
                            .Select(rndGrade => rndGrade(1, 13))
                            .First();

                var name = "Pesho" + (i + 1);
                var student = new Student(name, grade);
                student.Marks = marks;

                Thread.Sleep(15);

                yield return student;
            }
        }
Ejemplo n.º 2
0
 private bool IsFailDefault(Student student)
 {
     var average = student.Marks.Average();
     return average < 4.0;
 }