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); }
public void execute(AddCourseInput input, AddCourseOutput output) { Course course = new Course(input.getTitle(), input.getDescription(), input.getSuitable(), input.getPrice(), input.getNotice(), input.getOther()); output.setTitle(title); courseRepository.create(course); }
public void GetCourseByTitleControllerTest() { string title = "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(title); input.setDescription(description); input.setSuitable(suitable); input.setPrice(price); input.setNotice(notice); input.setOther(other); AddCourseOutput output = addCoursePresneter; addCourse.execute(input, output); GetCourseByTitle getCourseByTitle = new GetCourseByTitleImpl(courseRepository); GetCourseByTitleInput _input = (GetCourseByTitleInput)getCourseByTitle; GetCourseByTitleOutput getCourseByTitlePresneter = new GetCourseByTitlePresenter(); _input.setTitle(title); GetCourseByTitleOutput _output = getCourseByTitlePresneter; getCourseByTitle.execute(_input, _output); Assert.AreEqual(_output.getDescription(), "none"); DeleteCourse deleteCourse = new DeleteCourseImpl(courseRepository); DeleteCourseInput __input = (DeleteCourseInput)deleteCourse; DeleteCourseOutput deleteCoursePresneter = new DeleteCoursePresenter(); __input.setTitle(title); DeleteCourseOutput __output = deleteCoursePresneter; deleteCourse.execute(__input, __output); }
public void addCourseExecute(string title, string description, string suitable, string price, string notice, string other) { AddCourseInput input = (AddCourseInput)addCourse; input.setTitle(title); input.setDescription(description); input.setSuitable(suitable); input.setPrice(price); input.setNotice(notice); input.setOther(other); AddCourseOutput output = addCoursePresneter; addCourse.execute(input, output); }