public async Task VolunteerAcceptsTask() { var mediator = new Mock <IMediator>(); var task = Context.Tasks.First(); var user = Context.Users.First(); var command = new TaskStatusChangeCommandAsync { TaskId = task.Id, UserId = user.Id, TaskStatus = TaskStatus.Accepted }; var handler = new TaskStatusChangeHandlerAsync(Context, mediator.Object); await handler.Handle(command); var taskSignup = Context.TaskSignups.First(); mediator.Verify(b => b.PublishAsync(It.Is <TaskSignupStatusChanged>(notifyCommand => notifyCommand.SignupId == taskSignup.Id)), Times.Once()); }
public TaskStatusChangeHandlerTests() { mediator = new Mock<IMediator>(); handler = new TaskStatusChangeHandlerAsync(Context, mediator.Object); }
public async Task VolunteerAcceptsTask() { var mediator = new Mock<IMediator>(); var task = Context.Tasks.First(); var user = Context.Users.First(); var command = new TaskStatusChangeCommandAsync { TaskId = task.Id, UserId = user.Id, TaskStatus = AllReady.Areas.Admin.Features.Tasks.TaskStatus.Accepted }; var handler = new TaskStatusChangeHandlerAsync(Context, mediator.Object); await handler.Handle(command); var taskSignup = Context.TaskSignups.First(); mediator.Verify(b => b.PublishAsync(It.Is<TaskSignupStatusChanged>(notifyCommand => notifyCommand.SignupId == taskSignup.Id)), Times.Once()); }
public TaskStatusChangeHandlerTests() { mediator = new Mock <IMediator>(); handler = new TaskStatusChangeHandlerAsync(Context, mediator.Object); }