Exemple #1
0
        /// <inheritdoc/>
        public override IWolfResponse Deserialize(Type responseType, SerializedMessageData responseData)
        {
            // first deserialize the json message
            ChatUpdateResponse result = (ChatUpdateResponse)base.Deserialize(responseType, responseData);

            // assign binary data if any
            if (responseData.BinaryMessages?.Any() == true)
            {
                JObject responseBody = GetResponseJson(responseData)["body"] as JObject;
                if (responseBody == null)
                {
                    throw new ArgumentException("Chat update response requires to have a body property that is a JSON object", nameof(responseData));
                }
                if (responseBody["data"] != null)
                {
                    SerializationHelper.PopulateMessageRawData(ref result, responseData.BinaryMessages.First());
                }
            }

            return(result);
        }
 public static void ClassInitialize(TestContext context)
 {
     OkChatDeleteResponse      = JsonLoader.LoadJson <ChatDeleteResponse>(@"Chat/Data/chat_delete.json");
     OkChatPostMessageResponse = JsonLoader.LoadJson <ChatPostMessageResponse>(@"Chat/Data/chat_post_message.json");
     OkChatUpdateResponse      = JsonLoader.LoadJson <ChatUpdateResponse>(@"Chat/Data/chat_update.json");
 }