示例#1
0
        public async Task ProcessEventForgetToCreateList()
        {
            var mockSharepointManager = new MockSharepointManager();
            var courseCatalog         = new MockSharepointCourseCatalog();

            string courseId          = "COMP0101";
            string listToStoreEvents = "Attendance Events";

            courseCatalog.mockCatalog.Add(courseId, new CourseCatalogType {
                ListName = listToStoreEvents, JoinWebUrl = null
            });

            bool eventListExist = mockSharepointManager.CheckListExists(listToStoreEvents);

            Assert.False(eventListExist);

            var eventAggregator = new EventAggregator(mockSharepointManager, courseCatalog, new InMemoryLogger <EventAggregator>());

            StudentEvent eventToStore = new StudentEvent
            {
                CourseID     = courseId,
                EventType    = EventType.Attendance,
                ActivityType = "Video",
                ActivityName = "Introductory Lesson",
                Timestamp    = DateTime.UtcNow,
                Student      = new Student {
                    Email = "*****@*****.**", FirstName = "a", LastName = "b", ID = " 0"
                }
            };
            await eventAggregator.ProcessEvent(eventToStore);

            bool afterProcessEventListExist = mockSharepointManager.CheckListExists(listToStoreEvents);

            Assert.True(afterProcessEventListExist);
        }
        public void ConstructorCreatesCourseCatalogListIfNotExist()
        {
            var courseCatalogListName = "CourseCatalog";
            var settings = SharepointSettingsWithCourseCatalogName(courseCatalogListName);
            var mockSharepointManager = new MockSharepointManager();

            var courseCatalog = new SharepointCourseCatalog(Options.Create(settings), new InMemoryLogger <SharepointCourseCatalog>(), mockSharepointManager);


            bool catalogListWasCreated = mockSharepointManager.CheckListExists(courseCatalogListName);

            Assert.True(catalogListWasCreated);
        }