public async Task Result_ShouldBe_Success_IfTaskIsNotClosed() { var mockMediator = new Mock <IMediator>(); var message = new VolunteerTaskSignupCommand { TaskSignupModel = new VolunteerTaskSignupViewModel { VolunteerTaskId = 2, EventId = 1, UserId = "abc" } }; var sut = new VolunteerTaskSignupCommandHandler(mockMediator.Object, Context); var result = await sut.Handle(message); Assert.Equal(TaskResultStatus.Success, result.Status); Assert.Equal(1, Context.VolunteerTaskSignups.Count()); }
public async Task Result_ShouldBe_CampaignNotFound_IfCampaignIdDoesNotExist() { var mockMediator = new Mock <IMediator>(); var message = new VolunteerTaskSignupCommand { TaskSignupModel = new VolunteerTaskSignupViewModel { VolunteerTaskId = 1, EventId = 100, UserId = "abc" } }; var sut = new VolunteerTaskSignupCommandHandler(mockMediator.Object, Context); var result = await sut.Handle(message); Assert.Equal(VolunteerTaskSignupResult.FAILURE_EVENTNOTFOUND, result.Status); Assert.Equal(0, Context.VolunteerTaskSignups.Count()); }
public async Task Result_ShouldBe_TaskNotFound_IfTaskIdDoesNotExist() { var mockMediator = new Mock <IMediator>(); var message = new VolunteerTaskSignupCommand { TaskSignupModel = new VolunteerTaskSignupViewModel { VolunteerTaskId = 100, EventId = 1, UserId = "abc" } }; var sut = new VolunteerTaskSignupCommandHandler(mockMediator.Object, Context); var result = await sut.Handle(message); Assert.Equal(TaskResultStatus.Failure_TaskNotFound, result.Status); Assert.Equal(0, Context.VolunteerTaskSignups.Count()); }
public async Task Result_ShouldBe_ClosedTaskFailure_IfTaskIsClosed() { var mockMediator = new Mock <IMediator>(); var message = new VolunteerTaskSignupCommand { TaskSignupModel = new VolunteerTaskSignupViewModel { VolunteerTaskId = 1, EventId = 1, UserId = "abc" } }; var sut = new VolunteerTaskSignupCommandHandler(mockMediator.Object, Context); var result = await sut.Handle(message); Assert.Equal(VolunteerTaskSignupResult.FAILURE_CLOSEDTASK, result.Status); Assert.Equal(0, Context.VolunteerTaskSignups.Count()); }