public void SubmitChat_ChatCanBeRetrieved() { Chat chat = new Chat("Visual Studio unit testing chat submission."); Assert.IsTrue(chat.Submit()); currentUser.Chats = new Chats(CurrentUser.Id); Chat retrievedChat = currentUser.Chats.ChatCollection[0]; Assert.AreEqual(chat.Content, retrievedChat.Content); }
private void ParseChat(JObject joChat) { Chat chat = new Chat(); chat.ChatId = joChat.ParseJsonInt("id"); chat.UserId = joChat.ParseJsonInt("user_id"); chat.Content = joChat.ParseJsonString("content"); chat.CreatedAt = joChat.ParseJsonDateTime("created_at"); chat.UpdatedAt = joChat.ParseJsonDateTime("updated_at"); chat.PictureFileName = (joChat.SelectToken("picture") as JObject).ParseJsonString("url"); ChatCollection.Add(chat); }
private void ParseChat(JObject joChat) { Chat chat = new Chat(); chat.ChatId = joChat.ParseJsonInt("id"); chat.UserId = joChat.ParseJsonInt("user_id"); chat.Content = joChat.ParseJsonString("content"); chat.CreatedAt = joChat.ParseJsonDateTime("created_at"); chat.UpdatedAt = joChat.ParseJsonDateTime("updated_at"); chat.PictureFileName = (joChat.SelectToken("picture") as JObject).ParseJsonString("url"); if (chat.UserId != CurrentUser.Id) { chat.UserName = Relationships.Followers.Concat(Relationships.Following).Where(u => u.Id == chat.UserId).First().Name; chat.UserGravatarUrl = Relationships.Followers.Concat(Relationships.Following).Where(u => u.Id == chat.UserId).First().GravatarUrl; } else { chat.UserName = CurrentUser.Name; chat.UserGravatarUrl = CurrentUser.GravatarUrl; } ChatCollection.Add(chat); }