示例#1
0
        public void Test_GetProjects_CanWeAddACourseStudentAndProjectToDatabase()
        {
            //Arrange
            DateTime Date1   = new DateTime(2016, 08, 01);
            Student  student = new Student("John", "Doe", "*****@*****.**", "/img/jon.jpg", Date1);

            student.Save();

            DateTime date      = new DateTime(2016, 10, 3);
            Course   newCourse = new Course("Anthropolgy", date, 2);

            newCourse.Save();

            DateTime Date        = new DateTime(2016, 10, 3);
            Project  testProject = new Project("DiceGame", Date);

            testProject.Save();

            student.AddCourse(newCourse);
            //Act
            int rows = student.GetProjects().Count;

            //Assert
            Assert.Equal(0, rows);
        }
示例#2
0
        public void T9_GetCourses()
        {
            //Arrange
            DateTime Date1    = new DateTime(2016, 08, 01);
            Student  student1 = new Student("Jon", "Jone", "*****@*****.**", "/img/jon.jpg", Date1);

            student1.Save();

            Course course1 = new Course("Intro", Date1, 1);

            course1.Save();
            Course course2 = new Course("JavaScript", Date1, 1);

            course2.Save();


            //Act
            student1.AddCourse(course1);

            List <Course> result = student1.GetCourses();
            List <Course> test   = new List <Course> {
                course1
            };

            //Assert
            Assert.Equal(test, result);
        }
示例#3
0
        public void T10_DeleteCourse()
        {
            //Assert
            DateTime Date1    = new DateTime(2016, 08, 01);
            Student  student1 = new Student("Jon", "Jone", "*****@*****.**", "/img/jon.jpg", Date1);

            student1.Save();

            Course testCourse = new Course("Intro", Date1, 1);

            testCourse.Save();

            //Act
            student1.AddCourse(testCourse);
            //Student.DeleteCourse(student1.GetId(), testCourse.GetId());
            student1.DeleteCourse(testCourse.GetId());
            int result = student1.GetCourses().Count;

            //Assert
            Assert.Equal(0, result);
        }