コード例 #1
0
        public void EditCourseControllerTest()
        {
            string oldTitle    = "SA";
            string newTitle    = "New SA";
            string description = "none";
            string suitable    = "CS student";
            string price       = "10000";
            string notice      = "none";
            string other       = "none";


            CourseRepository courseRepository = new CourseRepositoryImpl();
            AddCourse        addCourse        = new AddCourseImpl(courseRepository);

            AddCourseInput  input = (AddCourseInput)addCourse;
            AddCourseOutput addCoursePresneter = new AddCoursePresenter();

            input.setTitle(oldTitle);
            input.setDescription(description);
            input.setSuitable(suitable);
            input.setPrice(price);
            input.setNotice(notice);
            input.setOther(other);

            AddCourseOutput output = addCoursePresneter;

            addCourse.execute(input, output);

            EditCourse editCourse = new EditCourseImpl(courseRepository);

            EditCourseInput  _input = (EditCourseInput)editCourse;
            EditCourseOutput editCoursePresneter = new EditCoursePresenter();

            _input.setOldTitle(oldTitle);
            _input.setTitle(newTitle);
            _input.setDescription(description);
            _input.setSuitable(suitable);
            _input.setPrice(price);
            _input.setNotice(notice);
            _input.setOther(other);

            EditCourseOutput _output = editCoursePresneter;

            editCourse.execute(_input, _output);
            Assert.AreEqual(_output.getNewTitle(), "New SA");

            DeleteCourse deleteCourse = new DeleteCourseImpl(courseRepository);

            DeleteCourseInput  __input = (DeleteCourseInput)deleteCourse;
            DeleteCourseOutput deleteCoursePresneter = new DeleteCoursePresenter();

            __input.setTitle(newTitle);

            DeleteCourseOutput __output = deleteCoursePresneter;

            deleteCourse.execute(__input, __output);
        }
コード例 #2
0
        public void execute(EditCourseInput input, EditCourseOutput output)
        {
            Course course = new Course(input.getTitle(),
                                       input.getDescription(),
                                       input.getSuitable(),
                                       input.getPrice(),
                                       input.getNotice(),
                                       input.getOther());

            output.setNewTitle(input.getTitle());
            courseRepository.update(input.getOldTitle(), course);
        }
コード例 #3
0
        public void editCourseExecute(string oldTitle, string title, string description, string suitable, string price, string notice, string other)
        {
            EditCourseInput input = (EditCourseInput)editCourse;

            input.setOldTitle(oldTitle);
            input.setTitle(title);
            input.setDescription(description);
            input.setSuitable(suitable);
            input.setPrice(price);
            input.setNotice(notice);
            input.setOther(other);

            EditCourseOutput output = editCoursePresenter;

            editCourse.execute(input, output);
        }