예제 #1
0
        public async void TestPutRoomMessagesReadAsync()
        {
            var roomId = RoomList != null && RoomList.Any() ? RoomList.First() : Room;
            var getMessagesParameters = new MessagesParameters {
                Force = true
            };
            var messagesResponse = await Client.GetRoomMessagesAsync(roomId, getMessagesParameters)
                                   .ConfigureAwait(false);

            AssertGetRoomMessagesResponse(messagesResponse);

            if (messagesResponse.Data == null || !messagesResponse.Data.Any())
            {
                WarnSkip("TestPutRoomMessagesReadAsync");
                return;
            }

            var messages  = messagesResponse.Data;
            var messageId = messages.LastOrDefault(x => x.Body != "[deleted]").MessasgeId;

            if (string.IsNullOrEmpty(messageId))
            {
                WarnSkip("TestPutRoomMessagesReadAsync");
                return;
            }

            var parameters = new TargetMessageParameters {
                MessageId = messageId
            };
            var response = await Client
                           .PutRoomMessagesReadAsync(roomId, parameters)
                           .ConfigureAwait(false);

            AssertPutRoomMessagesReadResponse(response);
        }
예제 #2
0
        public void TestStaticPutRoomMessagesRead()
        {
            var roomId = RoomList != null && RoomList.Any() ? RoomList.First() : Room;
            var getMessagesParameters = new MessagesParameters {
                Force = true
            };
            var messagesResponse = ChatworkClient.GetRoomMessages(Token, roomId, getMessagesParameters);

            AssertGetRoomMessagesResponse(messagesResponse);

            if (messagesResponse.Data == null || !messagesResponse.Data.Any())
            {
                WarnSkip("TestStaticPutRoomMessagesRead");
                return;
            }

            var messages  = messagesResponse.Data;
            var messageId = messages.LastOrDefault(x => x.Body != "[deleted]").MessasgeId;

            if (string.IsNullOrEmpty(messageId))
            {
                WarnSkip("TestStaticPutRoomMessagesRead");
                return;
            }

            var parameters = new TargetMessageParameters {
                MessageId = messageId
            };
            var response = ChatworkClient.PutRoomMessagesRead(Token, roomId, parameters);

            AssertPutRoomMessagesReadResponse(response);
        }
예제 #3
0
        public void TestPutRoomMessagesUnreadAsyncCallback()
        {
            var roomId = RoomList != null && RoomList.Any() ? RoomList.First() : Room;
            var getMessagesParameters = new MessagesParameters {
                Force = true
            };

            Client.GetRoomMessagesAsync(
                messagesResponse =>
            {
                AssertGetRoomMessagesResponse(messagesResponse);

                if (messagesResponse.Data == null || !messagesResponse.Data.Any())
                {
                    WarnSkip("TestPutRoomMessagesUnreadAsync");
                    return;
                }

                var messages  = messagesResponse.Data;
                var messageId = messages.FirstOrDefault(x => x.Body != "[deleted]").MessasgeId;

                if (string.IsNullOrEmpty(messageId))
                {
                    WarnSkip("TestPutRoomMessagesUnreadAsync");
                    return;
                }

                var parameters = new TargetMessageParameters {
                    MessageId = messageId
                };
                Client.PutRoomMessagesUnreadAsync(
                    AssertPutRoomMessagesUnreadResponse,
                    roomId,
                    parameters);
            },
                roomId,
                getMessagesParameters);
        }