Ejemplo n.º 1
0
        public async Task Should_update_status_to_done(TaskType taskType)
        {
            const string body      = "Automated Test Complete Task";
            const string updatedBy = "*****@*****.**";

            _newConferenceId = Guid.NewGuid();
            var task = new Alert(_newConferenceId, _newConferenceId, body, taskType);
            await TestDataManager.SeedAlerts(new List <Alert> {
                task
            });

            var command = new UpdateTaskCommand(_newConferenceId, task.Id, updatedBy);
            await _handler.Handle(command);

            List <Alert> alerts;

            await using (var db = new VideoApiDbContext(VideoBookingsDbContextOptions))
            {
                alerts = await db.Tasks.Where(x => x.ConferenceId == command.ConferenceId).ToListAsync();
            }

            var updatedAlert = alerts.First(x => x.Id == task.Id);

            updatedAlert.Should().NotBeNull();
            updatedAlert.Status.Should().Be(TaskStatus.Done);
            updatedAlert.Updated.Should().NotBeNull();
            updatedAlert.UpdatedBy.Should().Be(updatedBy);
        }
Ejemplo n.º 2
0
        public async Task GivenAConferenceHasTasks()
        {
            var conferenceId  = _context.Test.Conference.Id;
            var participantId = _context.Test.Conference.GetParticipants().First().Id;
            var judgeId       = _context.Test.Conference.GetJudge().Id;

            var alert1 = new Alert(conferenceId, conferenceId, "Automated Test", TaskType.Hearing);
            var alert2 = new Alert(conferenceId, participantId, "Automated Test", TaskType.Participant);
            var alert3 = new Alert(conferenceId, judgeId, "Automated Test", TaskType.Judge);

            _context.Test.Alerts = await _context.TestDataManager.SeedAlerts(new List <Alert>
            {
                alert1, alert2, alert3
            });
        }