Esempio n. 1
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);
        }
Esempio n. 2
0
 public ResourciumController(ResourciumAdapter resourciumAdapter, IOptions <ResourciumSettings> resourciumSettings)
 {
     _resourciumApiKey  = resourciumSettings.Value.ApiKey;
     _resourciumAdapter = resourciumAdapter;
 }