Example #1
0
 public void ShouldInsertComplexStudent()
 {
     var student = new Student
                       {
                           Email = "*****@*****.**",
                           Name = "Adrian Marinica",
                           Id = "Adrian3",
                           IsApproved = true,
                           IsLockedOut = false,
                           Notifications = new List<UserNotification>
                                               {
                                                   new UserNotification
                                                       {NotificationId = "1", UserSolved = false},
                                                   new UserNotification
                                                       {NotificationId = "2", UserSolved = false}
                                               },
                           SubscribedWebsites = new List<string>
                                                    {
                                                        "http://info.uaic.ro/~busaco/",
                                                        "http://info.uaic.ro/~rvlad/"
                                                    },
                           SubscribedGroups = new List<string>
                                                  {
                                                      "asfsagasgagas",
                                                      "asdbsdvsdvwe"
                                                  },
                           SubscribedFaculties = new List<string>
                                                     {
                                                         "info.uaic.ro"
                                                     },
                           FailedSubjects = new List<string>
                                                {
                                                     "4fcd249affd8e810ecc3c15f"
                                                },
                           OptionalSubjects = new List<string>
                                                  {
                                                      "4fcd249affd8e810ecc3c15e"
                                                  }
                       };
     var usersBL = new UsersBL();
     usersBL.InsertUser(student);
 }
Example #2
0
        public static void Assignment5()
        {
            List<Course> courses = new List<Course>();
            courses.Add(new Course("Programming", 7, false) );
            courses.Add(new Course("Mathematics", 5, false));
            courses.Add(new Course("Physics", 3, false));
            courses.Add(new Course("Something", 5, true));

            Random random = new Random();
            int numStudents = 100;
            int idCounter = 1000;
            List<Student> students = new List<Student>(numStudents);
            for (int i = 0; i < numStudents; i++)
            {
                Student student = new Student(Person.GenerateDateOfBirth(random), Person.GenerateName(random), "" + idCounter++);
                foreach (Course course in courses)
                {
                    student.Enroll(course);
                    if (course.IsGradeless)
                        student.GiveGrade(course, random.Next(2) == 1);
                    else
                        student.GiveGrade(course, random.Next(6));
                }
                students.Add(student);
            }
            
            foreach (Student student in students.OrderBy(s => s.StudyCredits).ThenBy(s => s.WeightedAverageGrade))
            {
                Console.WriteLine("ID: {1:D}, Name: {0},  Avg Grade: {2:N}, Weighted Avg: {3:N}, Credits: {4:D}", 
                    student.Name, student.StudentID, student.AverageGrade, student.WeightedAverageGrade, student.StudyCredits);
            }
            
        }