示例#1
0
        public void InMemoryDaoTest()
        {
            InMemoryDao      Dao        = new InMemoryDao();
            List <CourseDTO> courseDTOs = Dao.ListAllCourse();

            Assert.AreEqual(0, courseDTOs.Count);
        }
示例#2
0
        public void DeleteCourseTest()
        {
            InMemoryDao Dao = new InMemoryDao();

            Dao.AddCourse(new CourseDTO("name",
                                        "des",
                                        "obj",
                                        "price",
                                        "catyion",
                                        "remarks"));
            List <CourseDTO> courseDTOs = Dao.ListAllCourse();

            Assert.AreEqual(1, courseDTOs.Count);
            Dao.DeleteCourse(0);
            courseDTOs = Dao.ListAllCourse();
            Assert.AreEqual(0, courseDTOs.Count);
        }
示例#3
0
        public void AddCourseTest()
        {
            InMemoryDao Dao = new InMemoryDao();

            Dao.AddCourse(new CourseDTO("name",
                                        "des",
                                        "obj",
                                        "price",
                                        "catyion",
                                        "remarks"));
            List <CourseDTO> courseDTOs = Dao.ListAllCourse();

            Assert.AreEqual("name", courseDTOs[0].Name);
        }
示例#4
0
        public void UpdataCourseTest()
        {
            InMemoryDao Dao = new InMemoryDao();

            Dao.AddCourse(new CourseDTO("name",
                                        "des",
                                        "obj",
                                        "price",
                                        "catyion",
                                        "remarks"));
            List <CourseDTO> courseDTOs = Dao.ListAllCourse();

            Assert.AreEqual("name", courseDTOs[0].Name);
            Dao.UpdataCourse(0, new CourseDTO("Name",
                                              "123",
                                              "456",
                                              "price",
                                              "catyion",
                                              "remarks"));
            courseDTOs = Dao.ListAllCourse();
            Assert.AreEqual("Name", courseDTOs[0].Name);
            Assert.AreEqual("123", courseDTOs[0].Description);
            Assert.AreEqual("456", courseDTOs[0].Objective);
        }