public void AddNewStudentWithTakenNumber()
 {
     Student studentTest = new Student("Test", 10001);
     Student studentFest = new Student("fest", 10001);
     this.testingSchool.AddStudent(studentTest);
     this.testingSchool.AddStudent(studentFest);
 }
        public bool TryJoinStudentInCourse(Student student, int courseId)
        {
            if (student == null)
            {
                return false;
            }

            if (this.usedStudentsNumbers.Contains(student.Number))
            {
                if (this.usedCoursesId.Contains(courseId))
                {
                    return this.courses[courseId].Join(student);
                }

                return false;
            }
            else
            {
                if (this.usedCoursesId.Contains(courseId))
                {
                    bool isJoined = this.courses[courseId].Join(student);

                    if (isJoined)
                    {
                        this.usedStudentsNumbers.Add(student.Number);
                    }

                    return isJoined;
                }
            }

            // student wont to join to not existing course
            return false;
        }
 public void TestJoinCourseSuccessfully()
 {
     Course course = new Course();
     Student student = new Student("Valia", 34567);
     string result = course.JoinCourse(student);
     Assert.AreEqual("Done!", result);
 }
Exemple #4
0
 public void StudentToStringTest()
 {
     var student = new Student("Pesho", 12345);
     string expected = "Student name is: Pesho, with id: 12345";
     string actual = student.ToString();
     Assert.AreEqual(expected, actual);
 }
Exemple #5
0
 /// <summary>
 ///     Add an array of students to the class
 /// </summary>
 /// <param name="studentsInfo"></param>
 public void AddStudents(Student[] studentsInfo)
 {
     foreach (var student in studentsInfo)
     {
         this.classStudents.Add(student);
     }
 }
Exemple #6
0
        public void CourseCanNotRemoveAStudentThatItDoesntHave()
        {
            var course = new Course("math");
            var student = new Student("Pesho", 12345);

            course.RemoveStudent(student);
        }
 public void AddStudent(School school, Student student)
 {
     if (school.Courses.Single(x => x.Equals(this)) != null)
     {
         this.students.Add(student);
     }
 }
 public void AddStudentTwiseTest()
 {
     Course course = new Course("Math");
     Student student = new Student("Gosho", "Ivanov", 12345);
     course.AddStudent(student);
     course.AddStudent(student);
 }
Exemple #9
0
        static void Main(string[] args)
        {
            Student first=new Student("Mariq","564710");
            Student second = new Student("Pesho", "111123", "Gouem pich");
            Student third = new Student("Ganka", "126578");
            Disciplines basic = new Disciplines(10, "C# programming", "This is the prepration level at SoftUni.");
            Disciplines intermediate = new Disciplines(20, "Object Oriented Programming");
            Disciplines advanced = new Disciplines(30, "Structures of data and Algorithms", "This is the third level in SoftUni.");
            List<Student> students = new List<Student>();
            students.Add(first);
            students.Add(second);
            students.Add(third);

            List<Disciplines>SetOne=new List<Disciplines>();
            SetOne.Add(intermediate);
            SetOne.Add(intermediate);
            SetOne.Add(advanced);
            Teacher Nakov = new Teacher("Nakov", SetOne, "Gouem pich too :)");
            Teacher Znaiko = new Teacher("Znaiko", SetOne);
            List<Teacher> teachers = new List<Teacher>();
            teachers.Add(Nakov);
            teachers.Add(Znaiko);
            Class begginers = new Class(teachers,students);
            
        }
        static void Main()
        {
            //Students
            Student firstStudent = new Student("Pesho", "Kamburov", 1);
            Student secondStudent = new Student("Galin", "Imamov", 2);

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Students:");
            Console.ResetColor();
            Console.WriteLine(firstStudent.ToString());
            Console.WriteLine(secondStudent.ToString());
            //Teachers
            Teacher firstTeacher = new Teacher("Stefan", "Popov");
            firstTeacher.AddDiscipline(new Discipline("Math", 16, 10));
            firstTeacher.AddDiscipline(new Discipline("Physics", 20, 5));
            Teacher secondTeacher = new Teacher("Armin", "Van Buuren");
            secondTeacher.AddDiscipline(new Discipline("TechMusic", 15, 5));
            secondTeacher.AddDiscipline(new Discipline("Minimal", 18, 7));

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("\nTeachers:");
            Console.ResetColor();
            Console.WriteLine(firstTeacher.ToString());
            Console.WriteLine(secondTeacher.ToString());

            //School
            School school = new School();

            school.AddClass(new Class("12b", firstTeacher));
            school.AddClass(new Class("12a", secondTeacher));
        }
Exemple #11
0
 public void ConstructorCheck_IDnumber_IsInValidRange()
 {
     var student = new Student("Hartienov");
     Assert.IsTrue((Student.LowerBoundUniqueID <= student.UniqueID) &&
                   (student.UniqueID <= Student.UpperBoundUniqueID),
         "Student Id is not in the correct range");
 }
        public void TestStudentConstructorNumber()
        {
            Student misho = new Student("Misho Ivanov");
            Student pesho = new Student("Pesho Ivanov");

            Assert.IsTrue(misho.Number == (pesho.Number - 1), "Students' unique numbers are consecutive values.");
        }
Exemple #13
0
        public void CheckIf_NextStudent_GetCorrectIDIncrement()
        {
            var student = new Student("Marmalad Palachinkov");
            var secondStudent = new Student("Siren Banicharov");

            Assert.IsTrue(student.UniqueID + 1 == secondStudent.UniqueID);
        }
Exemple #14
0
        public void CompareToString()
        {
            var student = new Student("Marmalad Palachinkov");

            Assert.AreEqual("Marmalad Palachinkov - " + student.UniqueID, student.ToString(),
                "ToString is not returning in correct format.");
        }
Exemple #15
0
        public void RemoveStudent(Student student)
        {
            Validator.ValidateIfNotNull(student, "student");
            Validator.ValidateIfStudentsExists(this, student);

            this.students.Remove(student);
        }
Exemple #16
0
        public void TestTrivialStudentCase()
        {
            Student s = new Student("Ivan", 12345);

            bool result = s.Name == "Ivan" && s.Id == 12345;
            Assert.IsTrue(result);
        }
        public void TestRemoveNotExistingStudent()
        {
            Course css = new Course("CSS", students);
            Student koko = new Student("Kaloyan", 88823);

            css.RemoveStudent(koko);
        }
 public void StudentGroupShouldAddStudent()
 {
     var myClass = new StudentGroup("TelerikAcad");
     var student = new Student("Pe6o Ubaveca", Student.MinValidId);
     myClass.AddStudent(student);
     Assert.AreEqual(1, myClass.Students.Count);
 }
 public void CourseShouldAddStudent()
 {
     var course = new Course("Maths");
     var student = new Student("unnamed", Student.MinValidId);
     student.JoinCourse(course);
     Assert.AreEqual(1, course.Students.Count);
 }
Exemple #20
0
 public void TestStudentConstructorName()
 {
     string name = "Pesho";
     int uniqueNumber = 10000;
     Student target = new Student(name, uniqueNumber);
     Assert.AreEqual(target.Name, "Pesho");
 }
 public void CourseShouldThrowIfStudentAlreadyAdded()
 {
     var course = new Course("Maths");
     var student = new Student("unnamed", Student.MinValidId);
     student.JoinCourse(course);
     student.JoinCourse(course);
 }
Exemple #22
0
 public void RemoveStudent(Student student)
 {
     if (!this.Students.Remove(student))
     {
         throw new ArgumentException("Student not present in this class.");
     }
 }
 public void AddStudentAtsCourseMethodTest()
 {
     Course course = new Course("Math");
     Student student = new Student("Gosho", "Ivanov", 12345);
     course.AddStudent(student);
     Assert.AreEqual(student.ID, course.ListOfStudents[0].ID);
 }
 public void Student_AddingStudentsWithDifferentCredentials()
 {
     School mySchool = new School();
     Student pesho = new Student("pesho", 12344, mySchool);
     Student gosho = new Student("gosho", 12345, mySchool);
     Assert.AreNotEqual(pesho.UniqueNumber, gosho.UniqueNumber);
 }
 public void NameTest()
 {
     string name = "Anon";
     Student target = new Student(name);
     string actual = target.Name;
     Assert.AreEqual(name, actual);
 }
Exemple #26
0
 public void StudentInitializeTestName()
 {
     string name = "Pesho";
     int id = 10103;
     var student = new Student("Pesho", 10103);
     Assert.AreEqual(student.Name, "Pesho");
 }
 public void StudentShouldNotThrowWhenLeavingCourse()
 {
     var course = new Course("testCourse");
     var st = new Student("Pesho", 15000);
     st.JoinCourse(course);
     st.LeaveCourse(course);
 }
Exemple #28
0
        static void Main()
        {
            School justSchool = new School("JustSchool");

            Teacher ivanov = new Teacher("Ivanov");
            Teacher metodiev = new Teacher("Metodiev");

            Student milko = new Student("Milko", 15);
            Student vasil = new Student("Vasil", 2);

            Class bClass = new Class("BClass");

            Discipline math = new Discipline("Math", 5, 10);
            Discipline chemistry = new Discipline("Chemistry", 5, 12);

            justSchool.Classes.Add(bClass);

            bClass.Students.Add(milko);
            bClass.Students.Add(vasil);
            bClass.Teachers.Add(ivanov);
            bClass.Teachers.Add(metodiev);

            ivanov.Disciplines.Add(math);
            metodiev.Disciplines.Add(chemistry);

            bClass.Comment = "Pros";
        }
Exemple #29
0
 public void AddingTheSameStudentMoreThanOnce_ThrowException()
 {
     var spirt = new Course("Spirt");
     var student = new Student("Peter");
     spirt.AddStudent(student);
     spirt.AddStudent(student);
 }
Exemple #30
0
        static void Main(string[] args)
        {
            Student studentOne = new Student("Ivan", "Dvoikadjiq", 1);
            Student studentTwo = new Student("Maria", "Otlichnik", 2);
            Student studentThree = new Student("Ana", 3);
            
            IList<Student> students = new List<Student>();
            students.Add(studentOne);
            students.Add(studentTwo);
            students.Add(studentThree);

            Discipline disciplineOne = new Discipline("Matematika", 12, students, "muka");
            Discipline disciplineTwo = new Discipline("Muzika", 12, students);

            IList<Discipline> disciplines = new List<Discipline>();
            disciplines.Add(disciplineOne);
            disciplines.Add(disciplineTwo);

            Teacher teacherOne = new Teacher("Petko", disciplines);

            IList<Teacher> teachers = new List<Teacher>();
            teachers.Add(teacherOne);

            Class classOne = new Class("Detska gradina", students, teachers);
            Console.WriteLine(classOne);
        }
Exemple #31
0
        public static void Main()
        {
            School.Student student       = new School.Student("Milko", "Milchev", 2);
            School.Student studentTwo    = new School.Student("Ivancho", "Ivanov", 1);
            SchoolClass    seventhGradeA = new SchoolClass('a', new Teacher("Ms", "Ivanova"));

            seventhGradeA.AddStudent(student);
            seventhGradeA.AddStudent(studentTwo);
            seventhGradeA.RemoveStudent(studentTwo);
            School.Student studentThr = new School.Student("Grigor", "Grigorov", 1);
            student.AddComment("something");
            Console.WriteLine(student.Comments);
            TestStudentsAndWorkers.Test();
            AnimalHierarchyTest.Test();
        }
Exemple #32
0
        public void VerifyStudent()
        {
            School.Student student = new School.Student
            {
                Id   = 11,
                Name = "Jack",
                Age  = 60
            };

            IoC.I4IoC <School.Person> iStudent = student;

            string expected = "11 - Jack - 60";
            string returned = iStudent.ToString();

            Assert.IsTrue(expected == returned, "Expected: {0} Returned: {1}", expected, returned);
        }
        // When the user presses a key, determine whether to add a new student to a class, remove a student from a class, or modify the details of a student
        private void studentsList_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
            // If the user pressed Enter, edit the details for the currently selected student
            case Key.Enter: Student student = this.studentsList.SelectedItem as Student;

                // Use the StudentsForm to display and edit the details of the student
                StudentForm sf = new StudentForm();

                // Set the title of the form and populate the fields on the form with the details of the student
                sf.Title            = "Edit Student Details";
                sf.firstName.Text   = student.FirstName;
                sf.lastName.Text    = student.LastName;
                sf.dateOfBirth.Text = student.DateOfBirth.ToString("d");     // Format the date to omit the time element

                // Display the form
                if (sf.ShowDialog().Value)
                {
                    // When the user closes the form, copy the details back to the student
                    student.FirstName   = sf.firstName.Text;
                    student.LastName    = sf.lastName.Text;
                    student.DateOfBirth = DateTime.Parse(sf.dateOfBirth.Text);

                    // Enable saving (changes are not made permanent until they are written back to the database)
                    saveChanges.IsEnabled = true;
                }
                break;

            // If the user pressed Insert, add a new student
            case Key.Insert:

                // Use the StudentsForm to get the details of the student from the user
                sf = new StudentForm();

                // Set the title of the form to indicate which class the student will be added to (the class for the currently selected teacher)
                sf.Title = "New Student for Class " + teacher.Class;

                // Display the form and get the details of the new student
                if (sf.ShowDialog().Value)
                {
                    // When the user closes the form, retrieve the details of the student from the form
                    // and use them to create a new Student object
                    Student newStudent = new Student();
                    newStudent.FirstName   = sf.firstName.Text;
                    newStudent.LastName    = sf.lastName.Text;
                    newStudent.DateOfBirth = DateTime.Parse(sf.dateOfBirth.Text);

                    // Assign the new student to the current teacher
                    this.teacher.Students.Add(newStudent);

                    // Add the student to the list displayed on the form
                    this.studentsInfo.Add(newStudent);

                    // Enable saving (changes are not made permanent until they are written back to the database)
                    saveChanges.IsEnabled = true;
                }
                break;

            // If the user pressed Delete, remove the currently selected student
            case Key.Delete: student = this.studentsList.SelectedItem as Student;

                // Prompt the user to confirm that the student should be removed
                MessageBoxResult response = MessageBox.Show(
                    String.Format("Remove {0}", student.FirstName + " " + student.LastName),
                    "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Question,
                    MessageBoxResult.No);

                // If the user clicked Yes, remove the student from the database
                if (response == MessageBoxResult.Yes)
                {
                    this.schoolContext.Students.DeleteObject(student);

                    // Enable saving (changes are not made permanent until they are written back to the database)
                    saveChanges.IsEnabled = true;
                }
                break;
            }
        }
Exemple #34
0
        public void VerifyGradeStudent()
        {
            List <School.ClassRoom> classes = new List <School.ClassRoom>
            {
                new School.ClassRoom
                {
                    Id              = 1,
                    Description     = "Class of History",
                    Name            = "Hist1",
                    MinGradeForPass = 7f
                },
                new School.ClassRoom
                {
                    Id              = 2,
                    Description     = "Class of Biology",
                    Name            = "Bio1",
                    MinGradeForPass = 6f
                },
                new School.ClassRoom
                {
                    Id              = 3,
                    Description     = "Class of Math",
                    Name            = "Mth1",
                    MinGradeForPass = 8f
                }
            };

            School.Student student = new School.Student
            {
                Id   = 1,
                Age  = 15,
                Name = "Rick"
            };

            List <School.StudentClass> student_Classes = new List <School.StudentClass>
            {
                new  School.StudentClass()
                {
                    MyStudent   = student,
                    MyClassRoom = classes[0],
                    Grade       = 8.5f
                },

                new School.StudentClass()
                {
                    MyStudent   = student,
                    MyClassRoom = classes[1],
                    Grade       = 6.5f
                }
                ,
                new School.StudentClass()
                {
                    MyStudent   = student,
                    MyClassRoom = classes[2],
                    Grade       = 10f
                }
            };

            student.Classes = student_Classes;

            IoC.I4IoC <School.Person> iStudent = student;

            bool returned = ((Student)iStudent).IsAprooved();

            Assert.IsTrue(returned);
        }
Exemple #35
0
 public bool DoesStudentExist(Student student)
 {
     return(false);
 }
Exemple #36
0
 public void AddStudent(Student newStudent)
 {
     Students.Add(newStudent);
 }
Exemple #37
0
        // When the user presses a key, determine whether to add a new student to a class, remove a student from a class, or modify the details of a student
        private void studentsList_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
            // If the user pressed Enter, edit the details for the currently selected student
            case Key.Enter: Student student = this.studentsList.SelectedItem as Student;

                // Use the StudentsForm to display and edit the details of the student
                StudentForm sf = new StudentForm();

                // Set the title of the form and populate the fields on the form with the details of the student
                sf.Title            = "Edit Student Details";
                sf.firstName.Text   = student.FirstName;
                sf.lastName.Text    = student.LastName;
                sf.dateOfBirth.Text = student.DateOfBirth.ToString("d");     // Format the date to omit the time element

                // Display the form
                if (sf.ShowDialog().Value)
                {
                    // When the user closes the form, copy the details back to the student
                    student.FirstName   = sf.firstName.Text;
                    student.LastName    = sf.lastName.Text;
                    student.DateOfBirth = DateTime.ParseExact(sf.dateOfBirth.Text, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                    // Enable saving (changes are not made permanent until they are written back to the database)
                    saveChanges.IsEnabled = true;
                }
                break;

            // If the user pressed Insert, add a new student
            case Key.Insert:

                // Use the StudentsForm to get the details of the student from the user
                sf = new StudentForm();

                // Set the title of the form to indicate which class the student will be added to (the class for the currently selected teacher)
                sf.Title = "New Student for Class " + teacher.Class;

                // Display the form and get the details of the new student
                if (sf.ShowDialog().Value)
                {
                    // When the user closes the form, retrieve the details of the student from the form
                    // and use them to create a new Student object
                    Student newStudent = new Student();
                    newStudent.FirstName   = sf.firstName.Text;
                    newStudent.LastName    = sf.lastName.Text;
                    newStudent.DateOfBirth = DateTime.ParseExact(sf.dateOfBirth.Text, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                    // Assign the new student to the current teacher
                    this.teacher.Students.Add(newStudent);

                    // Add the student to the list displayed on the form
                    this.studentsInfo.Add(newStudent);

                    // Enable saving (changes are not made permanent until they are written back to the database)
                    saveChanges.IsEnabled = true;
                }
                break;

                // TODO: Exercise 3: Task 1a: If the user pressed Delete, remove the currently selected student
                // TODO: Exercise 3: Task 2a: Prompt the user to confirm that the student should be removed
                // TODO: Exercise 3: Task 3a: If the user clicked Yes, remove the student from the database
                // TODO: Exercise 3: Task 3b: Enable saving (changes are not made permanent until they are written back to the database)
            }
        }