コード例 #1
0
        static void Main(string[] args)
        {
            Student s  = new Student("Methela", "193411", 3.5f);
            Student s1 = new Student("Meth", "193412", 3.55f);
            Student s2 = new Student("Mim", "193413", 3.61f);

            Department d  = new Department("Computer Science", "CS");
            Department d1 = new Department("Electrical Engineering", "EEE");

            s.Dept = d;
            d.AddStudent(s);
            d.AddStudent(s1);
            s1.Dept = d;
            s2.Dept = d1;
            d.AddStudent(s2);

            s.ShowDdepartmentDetails();
            s2.ShowDdepartmentDetails();
            Console.Writeline("*****");
            d.Name = "Computer Science and Engineering";
            d1.Id  = "CSE";
            s1.ShowDdepartmentDetails();
            Console.WriteLine("*****");
            d.PrintStudent();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Student aStudent = new Student("Ayan", "2015-2-60-021", "01521211781", "*****@*****.**", "Dhaka");
            Student bStudent = new Student("Ayan", "2015-2-60-023", "01521211781", "*****@*****.**", "Dhaka");
            Student cStudent = new Student("Ayan", "2015-2-60-023", "01521211781", "*****@*****.**", "Dhaka");


            Department department = new Department("CSE", 60, "6th FLoor", "Taskid Jabed");
            string     message    = department.AddStudent(aStudent);

            message = department.AddStudent(bStudent);
            message = department.AddStudent(cStudent);

            Console.ReadKey();
        }
コード例 #3
0
        public void Delete_DeletesDepartmentAssociationsFromDatabase_DepartmentList()
        {
            DateTime dt          = new DateTime(2008, 3, 9, 16, 5, 7);
            Student  testStudent = new Student("Joe Green", dt);

            testStudent.Save();
            Department testDepartment = new Department("History");

            testDepartment.Save();
            Course testCourse = new Course("History of the World", "HIST101");

            testCourse.Save();
            testDepartment.AddStudent(testStudent);
            testDepartment.AddCourse(testCourse);
            testDepartment.Delete();
            List <Department> resultCourseDepartments  = testCourse.GetDepartments();
            List <Department> resultStudentDepartments = testStudent.GetDepartments();
            List <Department> testCourseDepartments    = new List <Department> {
            };
            List <Department> testStudentDepartments   = new List <Department> {
            };

            CollectionAssert.AreEqual(testCourseDepartments, resultCourseDepartments);
            CollectionAssert.AreEqual(testStudentDepartments, resultStudentDepartments);
        }
コード例 #4
0
        static void Main(string[] args)
        {
            Student s1 = new Student("Ridwan", "111222", 3.10f);
            Student s2 = new Student("Rijon", "333444", 3.85f);
            Student s3 = new Student("Jenia", "555666", 3.50f);


            Department d1 = new Department("Computer Science", "CS");
            Department d2 = new Department("Electrical Eng", "EEE");

            s1.Dept = d1;
            s2.Dept = d1;
            s3.Dept = d2;
            d1.AddStudent(s1, s2);
            d2.AddStudent(s3);

            s1.ShowDepartmentInfo();
            s3.ShowDepartmentInfo();
            Console.WriteLine("############");
            d1.Name = "Computer Science & Eng";
            d1.Id   = "CSE";
            s1.ShowDepartmentInfo();
            d1.PrintStudents();
            s3.Name = "Jenia";
            d2.PrintStudents();
        }
コード例 #5
0
        public ActionResult AddStudentToDept(int id)
        {
            Student    thisStudent    = Student.Find(Int32.Parse(Request.Form["newstudent"]));
            Department thisDepartment = Department.Find(id);

            thisDepartment.AddStudent(thisStudent);
            return(RedirectToAction("DepartmentDetails", id));
        }
コード例 #6
0
        public void AddStudent_AddStudentToDepartmentInDatabase_StudentList()
        {
            Department compSci    = new Department("Computer Science");
            Student    studentOne = new Student("Johnny", "Fall 2017");
            Student    studentTwo = new Student("Jill", "Fall 2017");

            compSci.Save();
            studentOne.Save();
            studentTwo.Save();

            compSci.AddStudent(studentOne);
            compSci.AddStudent(studentTwo);

            List <Student> expected = new List <Student> {
                studentOne, studentTwo
            };
            List <Student> actual = compSci.GetStudents();

            CollectionAssert.AreEqual(expected, actual);
        }
コード例 #7
0
        public void AddStudent_AddsStudentToDepartment_StudentList()
        {
            DateTime dt          = new DateTime(2008, 3, 9, 16, 5, 7);
            Student  testStudent = new Student("Joe Green", dt);

            testStudent.Save();
            Department testDepartment = new Department("History");

            testDepartment.Save();
            testDepartment.AddStudent(testStudent);
            List <Student> result   = testDepartment.GetStudents();
            List <Student> testList = new List <Student> {
                testStudent
            };

            CollectionAssert.AreEqual(testList, result);
        }
コード例 #8
0
        static void Main(string[] args)
        {
            Department d1 = new Department("Computer Science", "CS");
            Department d2 = new Department("Electrical Engg.", "EEE");
            Student    s1 = new Student("Rahim Kabir", "18-78969-2", 3.6f);
            Student    s2 = new Student("Abdul Haque", "18-78768-2", 3.2f);
            Student    s3 = new Student("Abul Kalam", "18-76754-2", 2.9f);

            d1.AddStudent(s1, s2, s3);
            s1.Department = d1;
            s2.Department = d1;
            s3.Department = d1;
            s1.Department.ShowInfo();
            d2.AddStudent(s3);

            d1.AllStudents();
            Console.WriteLine("***********************");
            d2.AllStudents();
        }