Exemplo n.º 1
0
        public async Task <IActionResult> GetElapsedTimeAsync([FromRoute] int attendeeId)
        {
            if (!await IsAttendeeValid(attendeeId))
            {
                return(NotFound());
            }

            return(Ok(await _testConductRepository.GetElapsedTimeAsync(attendeeId)));
        }
Exemplo n.º 2
0
        public async Task GetElapsedTimeAsyncTest()
        {
            var testAttendee = InitializeTestAttendeeParameters();

            await CreateTestAsync();

            await _testConductRepository.RegisterTestAttendeesAsync(testAttendee);

            var attendeeId = await _trappistDbContext.TestAttendees.OrderBy(x => x.Email).Where(x => x.Email.Equals(testAttendee.Email)).Select(x => x.Id).FirstOrDefaultAsync();

            //New entry to AttendeeAnswer table will be made since no answer is saved
            await _testConductRepository.SetElapsedTimeAsync(attendeeId, 1, false);

            //AttendeeAnswer entry will be updated with elapsed time
            await _testConductRepository.SetElapsedTimeAsync(attendeeId, 2, false);

            var elapsedTime = await _testConductRepository.GetElapsedTimeAsync(attendeeId);

            Assert.True(elapsedTime >= 0.0d);
        }