Esempio n. 1
0
        public void ParseConversation(string json)
        {
            ConversationJsonData conversationJsonData = null;
            Conversation         conversation         = null;

            if (string.IsNullOrEmpty(json))
            {
                throw new ArgumentNullException("Conversation json");
            }

            conversationJsonData = this.JsonConverter.Deserialize <ConversationJsonData>(json);
            if (conversationJsonData != null)
            {
                conversation = conversationJsonData.AsConversation(this);
            }

            if (conversation != null)
            {
                if (this.conversationsDictionary.ContainsKey(conversation.ID))
                {
                    this.conversationsDictionary[conversation.ID] = conversation;
                }
                else
                {
                    this.conversationsDictionary.Add(conversation.ID, conversation);
                }
            }
        }
Esempio n. 2
0
        // This section will be removed later in favor of unit tests.
        // Now the code simple doesn't have enought stability to create a suite of tests.

        public void TestParseConversation(string json)
        {
            ConversationJsonData conversationJsonData = null;
            Conversation         conversation         = null;

            if (string.IsNullOrEmpty(json))
            {
                throw new ArgumentNullException("Conversation json");
            }

            conversationJsonData = this.JsonConverter.Deserialize <ConversationJsonData>(json);
            if (conversationJsonData != null)
            {
                conversation = conversationJsonData.AsConversation(this);
            }

            Debugger.Break();
        }