public void TestStaticRoomTaskLifecycleAsyncCallback()
        {
            var roomId = RoomList != null && RoomList.Any() ? RoomList.First() : Room;

            TestStaticGetRoomTasksAsyncCallback(
                roomId,
                taskIdList => TestStaticPostRoomTasksAsyncCallback(
                    roomId,
                    extendedTaskIdList =>
            {
                var taskId = extendedTaskIdList.FirstOrDefault(x => !taskIdList.Contains(x));
                TestStaticGetRoomTaskAsyncCallback(roomId, taskId);
                TestStaticPutRoomTaskStatusAsyncCallback(roomId, taskId);
            }));

            // [GET] /rooms/{room_id}/tasks.
            void TestStaticGetRoomTasksAsyncCallback(long roomId, Action <IReadOnlyCollection <long> > next)
            {
                var parameters = new RoomTasksParameters
                {
                    AccountId          = AccountId,
                    AssignedByAccontId = AccountId,
                    Status             = TaskStatusValue.Open,
                };

                ChatworkClient.GetRoomTasksAsync(
                    Token,
                    response =>
                {
                    AssertGetRoomTasksResponse(response);

                    var taskIdList = response.Data
                                     ?.Select(x => x.TaskId).ToArray()
                                     ?? Array.Empty <long>();

                    next.Invoke(taskIdList);
                },
                    roomId,
                    parameters);
            }

            // [POST] /rooms/{room_id}/tasks.
            void TestStaticPostRoomTasksAsyncCallback(long roomId, Action <IReadOnlyCollection <long> > next)
            {
                var now        = DateTime.Now;
                var parameters = new NewRoomTaskParameters
                {
                    Body      = $"task test {now.Ticks}",
                    Limit     = now + TimeSpan.FromMinutes(60),
                    LimitType = LimitTypeValue.Date,
                    ToIds     = MemberList,
                };

                ChatworkClient.PostRoomTaskAsync(
                    Token,
                    response =>
                {
                    AssertPostRoomTasksResponse(response);
                    var taskIdList = response.Data.TaskIds ?? Array.Empty <long>();
                    next.Invoke(taskIdList);
                },
                    roomId,
                    parameters);
            }

            // [GET] /rooms/{room_id}/tasks/{task_id}.
            void TestStaticGetRoomTaskAsyncCallback(long roomId, long taskId)
            {
                ChatworkClient.GetRoomTaskAsync(
                    Token,
                    response => AssertGetRoomTaskResponse(response, taskId),
                    roomId,
                    taskId);
            }

            // [PUT] /rooms/{room_id}/tasks/{task_id}/status.
            void TestStaticPutRoomTaskStatusAsyncCallback(long roomId, long taskId)
            {
                var parameters = new UpdateRoomTaskStatusParameters
                {
                    Body = TaskStatusValue.Done,
                };

                ChatworkClient.PutRoomTaskStatusAsync(
                    Token,
                    response => AssertPutRoomTaskStatusResponse(response, taskId),
                    roomId,
                    taskId,
                    parameters);
            }
        }
        public void TestRoomTaskLifecycle()
        {
            var roomId             = RoomList != null && RoomList.Any() ? RoomList.First() : Room;
            var taskIdList         = TestGetRoomTasks(roomId);
            var extendedTaskIdList = TestPostRoomTasks(roomId);
            var taskId             = extendedTaskIdList.FirstOrDefault(x => !taskIdList.Contains(x));

            TestGetRoomTask(roomId, taskId);
            TestPutRoomTaskStatus(roomId, taskId);

            // [GET] /rooms/{room_id}/tasks.
            IReadOnlyCollection <long> TestGetRoomTasks(long roomId)
            {
                var parameters = new RoomTasksParameters
                {
                    AccountId          = AccountId,
                    AssignedByAccontId = AccountId,
                    Status             = TaskStatusValue.Open,
                };

                var response = Client.GetRoomTasks(roomId, parameters);

                AssertGetRoomTasksResponse(response);

                return(response.Data
                       ?.Select(x => x.TaskId).ToArray()
                       ?? Array.Empty <long>());
            }

            // [POST] /rooms/{room_id}/tasks.
            IReadOnlyCollection <long> TestPostRoomTasks(long roomId)
            {
                var now        = DateTime.Now;
                var parameters = new NewRoomTaskParameters
                {
                    Body      = $"task test {now.Ticks}",
                    Limit     = now + TimeSpan.FromMinutes(60),
                    LimitType = LimitTypeValue.Date,
                    ToIds     = MemberList,
                };

                var response = Client.PostRoomTask(roomId, parameters);

                AssertPostRoomTasksResponse(response);
                return(response.Data.TaskIds ?? Array.Empty <long>());
            }

            // [GET] /rooms/{room_id}/tasks/{task_id}.
            void TestGetRoomTask(long roomId, long taskId)
            {
                var response = Client.GetRoomTask(roomId, taskId);

                AssertGetRoomTaskResponse(response, taskId);
            }

            // [PUT] /rooms/{room_id}/tasks/{task_id}.
            void TestPutRoomTaskStatus(long roomId, long taskId)
            {
                var parameters = new UpdateRoomTaskStatusParameters
                {
                    Body = TaskStatusValue.Done,
                };

                var response = Client.PutRoomTaskStatus(roomId, taskId, parameters);

                AssertPutRoomTaskStatusResponse(response, taskId);
            }
        }