public void T4_Find_inDataBase()
 {
     Course firstCourse = new Course("Biology", 101);
       firstCourse.Save();
       Course resultCourse = Course.Find(firstCourse.GetId());
       Assert.Equal(firstCourse,resultCourse);
 }
        public void T3_SaveInDatabase_True()
        {
            Course firstCourse = new Course("Biology", 101);
            firstCourse.Save();
            List<Course> newList = Course.GetAll();
            List<Course> testCourse = new List<Course>{firstCourse};

            Assert.Equal(testCourse, newList);
        }
        public void T5_AddStudentsToCourse()
        {
            Course firstCourse = new Course("Biology", 101);
              Course secondCourse = new Course("Physics", 102);
              firstCourse.Save();
              secondCourse.Save();

              DateTime fakeTime=new DateTime(2016,08,02);
              Student testStudent = new Student("Steve", fakeTime);
              testStudent.Save();

              testStudent.AddCourses(firstCourse);
              testStudent.AddCourses(secondCourse);
              List<Course> temp = Course.GetAll();

              List<Course> resultCourse = testStudent.GetCourses();
              List<Course> testCourses=new List<Course>{firstCourse,secondCourse};
              Assert.Equal(testCourses,temp);
        }
        public void T6_AddStudentTo_Course_True()
        {
            Course testCourse = new Course("Biology", 101);
             testCourse.Save();

             DateTime fakeTime=new DateTime(2016,08,02);
             Student testStudent = new Student("Steve", fakeTime);
             testStudent.Save();

             Student testStudent2 = new Student("Mike", fakeTime);
             testStudent2.Save();

             testCourse.AddStudents(testStudent);
             testCourse.AddStudents(testStudent2);
             List<Student> allStudent= Student.GetAll();
             List<Student> result = testCourse.GetStudents();
             List<Student> testList = new List<Student>{testStudent,testStudent2};

             Assert.Equal(testList, result);
        }
        public HomeModule()
        {
            Get["/"] = _ =>{
            List<Student> allStudents = Student.GetAll();
            List<Course> allCourses = Course.GetAll();

            Dictionary<string,object> model = new Dictionary<string,object>{};
            model.Add("student",allStudents);
            model.Add("course",allCourses);
            return View["index.cshtml",model];
              };

              Post["/add/new/student"]=_=>{
            Student newStudent = new Student(Request.Form["new-name"], Request.Form["new-date"]);
            newStudent.Save();

            List<Student> allStudents = Student.GetAll();
            List<Course> allCourses = Course.GetAll();

            Dictionary<string,object> model = new Dictionary<string,object>{};
            model.Add("student",allStudents);
            model.Add("course",allCourses);
            return View["index.cshtml",model];
              };
              Post["/add/new/course"]=_=>{
            Course newCourse = new Course(Request.Form["course-name"], Request.Form["course-number"]);
            newCourse.Save();

            List<Student> allStudents = Student.GetAll();
            List<Course> allCourses = Course.GetAll();

            Dictionary<string,object> model = new Dictionary<string,object>{};
            model.Add("student",allStudents);
            model.Add("course",allCourses);
            return View["index.cshtml",model];
              };
        }