예제 #1
0
 public CourseResult(Course course, string update, string owner)
 {
     this.course = course;
     this.update = update;
     this.owner = owner;
 }
예제 #2
0
        public void GetTopicsByCourseId()
        {
            Discipline cur = new Discipline {Name = "Discipline", Id = 1};
            _Storage.AddDiscipline(cur);

            Chapter chapter = new Chapter {Name = "Chapter", Discipline = cur, Id = 1};
            _Storage.AddChapter(chapter);

            Course course = new Course {Name = "Course", Id = 1};
            Topic topic = new Topic
                              {
                                  Name = "Topic",
                                  Chapter = chapter,
                                  TopicType = _Storage.GetTopicType(1),
                                  Id = 1,
                                  CourseRef = course.Id
                              };
            Topic topic1 = new Topic
                               {
                                   Name = "Topic1",
                                   Chapter = chapter,
                                   TopicType = _Storage.GetTopicType(1),
                                   Id = 2,
                                   CourseRef = course.Id
                               };
            _Storage.AddTopic(topic);
            AdvAssert.AreEqual(topic, _Storage.GetTopicsByCourseId(course.Id).First());
            _Storage.AddTopic(topic1);
            List<Topic> expected = new List<Topic> {topic, topic1};
            AdvAssert.AreEqual(expected, _Storage.GetTopicsByCourseId(course.Id).ToList());
            try
            {
                _Storage.DeleteTopic(topic.Id);
                _Storage.DeleteTopic(topic1.Id);
                _Storage.GetTopicsByCourseId(course.Id);
                Assert.Fail();
            }
            catch (Exception)
            {
                Assert.True(true);
            }
        }
예제 #3
0
        public void GetThemesByCourseId()
        {
            Curriculum cur = new Curriculum() { Name = "Curriculum", Id = 1 };
            _Storage.AddCurriculum(cur);

            Stage stage = new Stage() { Name = "Stage", Curriculum = cur, Id = 1 };
            _Storage.AddStage(stage);

            Course course = new Course() { Name = "Course", Id = 1 };
            Theme theme = new Theme() { Name = "Theme", Stage = stage, ThemeType = _Storage.GetThemeType(1), Id = 1, CourseRef = course.Id };
            Theme theme1 = new Theme() { Name = "Theme1", Stage = stage, ThemeType = _Storage.GetThemeType(1), Id = 2, CourseRef = course.Id };
            _Storage.AddTheme(theme);
            AdvAssert.AreEqual(theme, _Storage.GetThemesByCourseId(course.Id).First());
            _Storage.AddTheme(theme1);
            List<Theme> expected = new List<Theme>() { theme, theme1 };
            AdvAssert.AreEqual(expected, _Storage.GetThemesByCourseId(course.Id).ToList());
            try
            {
                _Storage.DeleteTheme(theme.Id);
                _Storage.DeleteTheme(theme1.Id);
                _Storage.GetThemesByCourseId(course.Id);
                Assert.Fail();
            }
            catch (Exception)
            {
                Assert.True(true);
            }
        }
예제 #4
0
        public void UpdateCourseTest()
        {
            var oldCourse = this.Storage.GetCourse(2);

            var newCourse = new Course { Name = "New Course" };

            this.Storage.UpdateCourse(2, newCourse);
            Assert.AreEqual(oldCourse.Owner, newCourse.Owner);
            Assert.AreEqual(oldCourse.Name, newCourse.Name);
            Assert.AreEqual(oldCourse.Updated, newCourse.Updated);
            Assert.AreEqual(oldCourse.Created, newCourse.Created);
            Assert.AreEqual(oldCourse.Locked, newCourse.Locked);
        }
예제 #5
0
        public void UpdateCourseTest()
        {
            Course oldCourse = _Storage.GetCourse(2);

            Course newCourse = new Course {Name = "New Course"};

            _Storage.UpdateCourse(2, newCourse);
            Assert.AreNotEqual(oldCourse.Owner, newCourse.Owner);
            Assert.AreEqual(oldCourse.Name, newCourse.Name);
            Assert.AreNotEqual(oldCourse.Updated, newCourse.Updated);
        }
예제 #6
0
        public void SetUpFixture()
        {
            // defining mocks
            this.windsorContainerMock = new Mock<IWindsorContainer>();
            this.lmsServiceMock = new Mock<LmsService>(this.windsorContainerMock.Object);

            this.userServiceMock = new Mock<IUserService>();
            this.courseServiceMock = new Mock<ICourseService>();
            this.curriculumServiceMock = new Mock<ICurriculumService>();

            this.mlcProxyMock = new Mock<IMlcProxy>();

            this.trainingController = new TrainingController(this.mlcProxyMock.Object);

            PluginController.LmsService = this.lmsServiceMock.Object;

            // setuping mocks
            this.mlcProxyMock.Setup(
                proxy => proxy.GetAttemptId(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<TopicTypeEnum>())).Returns(
                    DummyAttemptId);

            this.windsorContainerMock.Setup(container => container.Resolve<IUserService>()).Returns(
                this.userServiceMock.Object);
            this.windsorContainerMock.Setup(container => container.Resolve<ICourseService>()).Returns(
                this.courseServiceMock.Object);
            this.windsorContainerMock.Setup(container => container.Resolve<ICurriculumService>()).Returns(
                this.curriculumServiceMock.Object);

            this.dummyCurriculumChapterTopic = new CurriculumChapterTopic
                { Id = DummyCurriculumChapterTopicId, Topic = new Topic { Name = "C++ Testing" } };
            this.dummyCourse = new Course { Id = DummyCourseId };
            this.dummyUser = new User();
        }
예제 #7
0
 partial void DeleteCourse(Course instance);
예제 #8
0
 partial void UpdateCourse(Course instance);
예제 #9
0
 partial void InsertCourse(Course instance);