public async Task WhenHandlingTaskByTaskIdQueryGetTaskIsInvokedWithCorrectTaskId()
        {
            var message = new VolunteerTaskByVolunteerTaskIdQuery {
                VolunteerTaskId = VolunteerTaskId
            };

            var sut           = new VolunteerTaskByVolunteerTaskIdQueryHandler(Context);
            var volunteerTask = await sut.Handle(message);

            Assert.Equal(volunteerTask.Id, VolunteerTaskId);
        }
示例#2
0
        public async Task WhenHandlingTaskByTaskIdQueryGetTaskIsInvokedWithCorrectTaskId()
        {
            var options = this.CreateNewContextOptions();

            const int volunteerTaskId = 1;
            var       message         = new VolunteerTaskByVolunteerTaskIdQuery {
                VolunteerTaskId = volunteerTaskId
            };

            using (var context = new AllReadyContext(options)) {
                context.VolunteerTasks.Add(new VolunteerTask {
                    Id = volunteerTaskId
                });
                await context.SaveChangesAsync();
            }

            using (var context = new AllReadyContext(options)) {
                var sut           = new VolunteerTaskByVolunteerTaskIdQueryHandler(context);
                var volunteerTask = await sut.Handle(message);

                Assert.Equal(volunteerTask.Id, volunteerTaskId);
            }
        }