Ejemplo n.º 1
0
        public async Task ProcessEventsSetsEventTypeToAttendanceForZoomOrTeamsEvents()
        {
            var eventAggregator = new MockEventAggregator();
            var moodleAdapter   = new MoodleAdapter(eventAggregator, new MockIdentityResolver(), CreateLogger());

            CaliperActor caliperActor = new CaliperActor
            {
                Id         = "1",
                ActorType  = "http://purl.imsglobal.org/caliper/v1/lis/Person",
                Name       = "John Doe",
                Extensions = new CaliperActorExtensions {
                    Email = "*****@*****.**"
                }
            };
            string zoomActivityType         = "zoom";
            string studentRole              = "http://purl.imsglobal.org/vocab/lis/v2/membership#Learner";
            CaliperEventBatchDto zoomEvents = EventBatch(caliperActor, "any", "http://purl.imsglobal.org/caliper/v1/lis/" + zoomActivityType, "COMP0101", MoodleAdapter.COURSE_GROUP_TYPE, studentRole);

            await moodleAdapter.ProcessEvents(zoomEvents);

            Assert.Single(eventAggregator.processedEvents);
            var processedEvent = eventAggregator.processedEvents[0];

            Assert.Equal(EventType.Attendance, processedEvent.EventType);
        }
Ejemplo n.º 2
0
        public async Task ConvertsResourciumEventToStudentEvent()
        {
            MockEventAggregator mockAggregator = new MockEventAggregator();
            var resourciumAdapter = new ResourciumAdapter(mockAggregator);
            var incomingEvent     = new ResourciumEventDto
            {
                Timestamp = DateTime.Today,
                Student   = new ResourciumStudentDto {
                    ID = "id", Email = "*****@*****.**", FirstName = "A", LastName = "B"
                }
            };

            await resourciumAdapter.ProcessEvent(incomingEvent);

            var processedEvents = mockAggregator.processedEvents;

            Assert.Single(processedEvents);
            var convertedEvent = processedEvents[0];

            Assert.Equal(incomingEvent.Timestamp, convertedEvent.Timestamp);
            Assert.Equal(incomingEvent.Student.ID, convertedEvent.Student.ID);
            Assert.Equal(incomingEvent.Student.Email, convertedEvent.Student.Email);
            Assert.Equal(incomingEvent.Student.FirstName, convertedEvent.Student.FirstName);
            Assert.Equal(incomingEvent.Student.LastName, convertedEvent.Student.LastName);
            Assert.Equal(Orca.Entities.EventType.Attendance, convertedEvent.EventType);
            Assert.Equal(ResourciumAdapter.MANUAL_ATTENDANCE_COURSE_ID, convertedEvent.CourseID);
        }
Ejemplo n.º 3
0
        public async Task ProcessEventsAcceptsEventsAboutStudentsInteractingWithCourses()
        {
            var eventAggregator = new MockEventAggregator();
            var moodleAdapter   = new MoodleAdapter(eventAggregator);

            CaliperActor caliperActor = new CaliperActor
            {
                Id         = "1",
                ActorType  = "http://purl.imsglobal.org/caliper/v1/lis/Person",
                Name       = "John Doe",
                Extensions = new CaliperActorExtensions {
                    Email = "*****@*****.**"
                }
            };
            string activityType = "survey";
            string studentRole  = "http://purl.imsglobal.org/vocab/lis/v2/membership#Learner";
            CaliperEventBatchDto eventsWithStudentRole = EventBatch(caliperActor, "any", "http://purl.imsglobal.org/caliper/v1/lis/" + activityType, "COMP0101", MoodleAdapter.COURSE_GROUP_TYPE, studentRole);

            await moodleAdapter.ProcessEvents(eventsWithStudentRole);

            Assert.Single(eventAggregator.processedEvents);
            var             processedEvent = eventAggregator.processedEvents[0];
            CaliperEventDto submittedEvent = eventsWithStudentRole.Data[0];

            Assert.Equal(submittedEvent.Actor.Name, processedEvent.Student.FirstName + " " + processedEvent.Student.LastName);
            Assert.Equal(submittedEvent.Actor.Extensions.Email, processedEvent.Student.Email);
            Assert.Equal(submittedEvent.Actor.Id, processedEvent.Student.ID);
            Assert.Equal(submittedEvent.Object.Name, processedEvent.ActivityName);
            Assert.Equal(activityType, processedEvent.ActivityType);
            Assert.Equal(submittedEvent.Group.Name, processedEvent.CourseID);
            Assert.Equal(submittedEvent.EventTime, processedEvent.Timestamp);
        }
Ejemplo n.º 4
0
        public async Task ProcessTeamsMeeting()
        {
            var _graphHelper     = new MockGraphHelper();
            var _logger          = new InMemoryLogger <MsGraphAdapter>();
            var _courseCatalog   = new MockSharepointCourseCatalog();
            var _eventAggregator = new MockEventAggregator();
            var _graphAdapter    = new MsGraphAdapter(_eventAggregator, _logger, _graphHelper, _courseCatalog);


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

            _courseCatalog.mockCatalog.Add(courseId, new CourseCatalogType {
                ListName = listToStoreEvents, JoinWebUrl = "testjoinweburl.com"
            });

            // JoinWebUrl does not exist in course catalog
            var callIdJoinWebUrlNotExist = "22222";
            await _graphAdapter.ProcessEvents(callIdJoinWebUrlNotExist);

            Assert.Empty(_eventAggregator.processedEvents);

            //Only organiser is in meeting
            var callIdJoinWebUrlOrganiserOnly = "44444";
            await _graphAdapter.ProcessEvents(callIdJoinWebUrlOrganiserOnly);

            Assert.Empty(_eventAggregator.processedEvents);

            // JoinWebUrl exists in course catalog
            var callIdJoinWebUrl = "33333";
            await _graphAdapter.ProcessEvents(callIdJoinWebUrl);

            Assert.Single(_eventAggregator.processedEvents);

            //Ensure event organiser data isn't sent to event aggregator
            Assert.True(1 == _eventAggregator.processedEvents.Count());

            //Correct student data is stored
            var processedEvent = _eventAggregator.processedEvents[0];

            Assert.Equal("COMP0102", processedEvent.CourseID);
            Assert.Equal(EventType.Attendance, processedEvent.EventType);
            Assert.Equal("Meeting", processedEvent.ActivityType);
            Assert.Equal("Weekly Lecture", processedEvent.ActivityName);
            Assert.Equal("*****@*****.**", processedEvent.Student.Email);
            Assert.Equal("John", processedEvent.Student.FirstName);
            Assert.Equal("Doe", processedEvent.Student.LastName);
            Assert.Equal("00000", processedEvent.Student.ID);
        }
Ejemplo n.º 5
0
        public async Task ProcessTeamsMeetingWithoutJoinWebUrl()
        {
            var _graphHelper     = new MockGraphHelper();
            var _logger          = new InMemoryLogger <MsGraphAdapter>();
            var _courseCatalog   = new MockSharepointCourseCatalog();
            var _eventAggregator = new MockEventAggregator();
            var _graphAdapter    = new MsGraphAdapter(_eventAggregator, _logger, _graphHelper, _courseCatalog);

            var    callId            = "11111";
            string courseId          = "COMP0102";
            string listToStoreEvents = "Attendance Events";

            _courseCatalog.mockCatalog.Add(courseId, new CourseCatalogType {
                ListName = listToStoreEvents, JoinWebUrl = "testjoinweburl.com"
            });

            await _graphAdapter.ProcessEvents(callId);

            Assert.Empty(_eventAggregator.processedEvents);
        }
Ejemplo n.º 6
0
        public async Task ProcessEventsIgnoresEventsIfActorNotStudent()
        {
            var eventAggregator = new MockEventAggregator();
            var moodleAdapter   = new MoodleAdapter(eventAggregator, new MockIdentityResolver(), CreateLogger());

            CaliperActor caliperActor = new CaliperActor
            {
                Id         = "1",
                ActorType  = "http://purl.imsglobal.org/caliper/v1/lis/Person",
                Name       = "John Doe",
                Extensions = new CaliperActorExtensions {
                    Email = "*****@*****.**"
                }
            };
            string instructorRole = "http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor";
            CaliperEventBatchDto eventsWithInstructorRole = EventBatch(caliperActor, "any", "http://purl.imsglobal.org/caliper/v1/lis/url", "COMP0101", MoodleAdapter.COURSE_GROUP_TYPE, instructorRole);

            await moodleAdapter.ProcessEvents(eventsWithInstructorRole);

            Assert.Empty(eventAggregator.processedEvents);
        }
Ejemplo n.º 7
0
        public async Task ProcessEventsIgnoresEventIfStudentIdCouldNotBeResolvedThroughEmail()
        {
            var eventAggregator         = new MockEventAggregator();
            var failingIdentityResolver = new FailingIdentityResolver();
            var moodleAdapter           = new MoodleAdapter(eventAggregator, failingIdentityResolver, CreateLogger());

            CaliperActor caliperActor = new CaliperActor
            {
                Id         = "1",
                ActorType  = "http://purl.imsglobal.org/caliper/v1/lis/Person",
                Name       = "John Doe",
                Extensions = new CaliperActorExtensions {
                    Email = "*****@*****.**"
                }
            };
            string activityType = "survey";
            string studentRole  = "http://purl.imsglobal.org/vocab/lis/v2/membership#Learner";
            CaliperEventBatchDto eventsThatShouldBeIgnored = EventBatch(caliperActor, "any", "http://purl.imsglobal.org/caliper/v1/lis/" + activityType, "COMP0101", MoodleAdapter.COURSE_GROUP_TYPE, studentRole);

            await moodleAdapter.ProcessEvents(eventsThatShouldBeIgnored);

            Assert.Empty(eventAggregator.processedEvents);
        }