public async Task Result_ShouldBe_Success_IfTaskIsNotClosed()
        {
            var mockMediator = new Mock<IMediator>();
            var message = new TaskSignupCommandAsync { TaskSignupModel = new EventSignupViewModel { TaskId = 2, EventId = 1, UserId = "abc" } };

            var sut = new TaskSignupHandlerAsync(mockMediator.Object, Context);
            var result = await sut.Handle(message);

            Assert.Equal(TaskSignupResult.SUCCESS, result.Status);
            Assert.Equal(1, Context.TaskSignups.Count());
        }
        public async Task Result_ShouldBe_TaskNotFound_IfTaskIdDoesNotExist()
        {
            var mockMediator = new Mock<IMediator>();
            var message = new TaskSignupCommandAsync { TaskSignupModel = new EventSignupViewModel { TaskId = 100, EventId = 1, UserId = "abc" } };

            var sut = new TaskSignupHandlerAsync(mockMediator.Object, Context);
            var result = await sut.Handle(message);

            Assert.Equal(TaskSignupResult.FAILURE_TASKNOTFOUND, result.Status);
            Assert.Equal(0, Context.TaskSignups.Count());
        }
        public async Task Result_ShouldBe_ClosedTaskFailure_IfTaskIsClosed()
        {
            var mockMediator = new Mock<IMediator>();
            var message = new TaskSignupCommandAsync { TaskSignupModel = new EventSignupViewModel { TaskId = 1, EventId = 1, UserId = "abc" } };

            var sut = new TaskSignupHandlerAsync(mockMediator.Object, Context);
            var result = await sut.Handle(message);

            Assert.Equal(TaskSignupResult.FAILURE_CLOSEDTASK, result.Status);
            Assert.Equal(0, Context.TaskSignups.Count());
        }
        public async Task Result_ShouldBe_Success_IfTaskIsNotClosed()
        {
            var mockMediator = new Mock <IMediator>();
            var message      = new TaskSignupCommandAsync {
                TaskSignupModel = new EventSignupViewModel {
                    TaskId = 2, EventId = 1, UserId = "abc"
                }
            };

            var sut    = new TaskSignupHandlerAsync(mockMediator.Object, Context);
            var result = await sut.Handle(message);

            Assert.Equal(TaskSignupResult.SUCCESS, result.Status);
            Assert.Equal(1, Context.TaskSignups.Count());
        }
        public async Task Result_ShouldBe_TaskNotFound_IfTaskIdDoesNotExist()
        {
            var mockMediator = new Mock <IMediator>();
            var message      = new TaskSignupCommandAsync {
                TaskSignupModel = new EventSignupViewModel {
                    TaskId = 100, EventId = 1, UserId = "abc"
                }
            };

            var sut    = new TaskSignupHandlerAsync(mockMediator.Object, Context);
            var result = await sut.Handle(message);

            Assert.Equal(TaskSignupResult.FAILURE_TASKNOTFOUND, result.Status);
            Assert.Equal(0, Context.TaskSignups.Count());
        }
        public async Task Result_ShouldBe_ClosedTaskFailure_IfTaskIsClosed()
        {
            var mockMediator = new Mock <IMediator>();
            var message      = new TaskSignupCommandAsync {
                TaskSignupModel = new EventSignupViewModel {
                    TaskId = 1, EventId = 1, UserId = "abc"
                }
            };

            var sut    = new TaskSignupHandlerAsync(mockMediator.Object, Context);
            var result = await sut.Handle(message);

            Assert.Equal(TaskSignupResult.FAILURE_CLOSEDTASK, result.Status);
            Assert.Equal(0, Context.TaskSignups.Count());
        }