public void GroupsDiscussRepliesGetListTest() { var topics = AuthInstance.GroupsDiscussTopicsGetList(TestData.GroupId, 1, 100); Assert.IsNotNull(topics, "Topics should not be null."); Assert.AreNotEqual(0, topics.Count, "Should be more than one topics return."); var firstTopic = topics.First(t => t.RepliesCount > 0); var replies = AuthInstance.GroupsDiscussRepliesGetList(firstTopic.TopicId, 1, 10); Assert.AreEqual(firstTopic.TopicId, replies.TopicId, "TopicId's should be the same."); Assert.AreEqual(firstTopic.Subject, replies.Subject, "Subject's should be the same."); Assert.AreEqual(firstTopic.Message, replies.Message, "Message's should be the same."); Assert.AreEqual(firstTopic.DateCreated, replies.DateCreated, "DateCreated's should be the same."); Assert.AreEqual(firstTopic.DateLastPost, replies.DateLastPost, "DateLastPost's should be the same."); Assert.IsNotNull(replies, "Replies should not be null."); var firstReply = replies.First(); Assert.IsNotNull(firstReply.ReplyId, "ReplyId should not be null."); var reply = AuthInstance.GroupsDiscussRepliesGetInfo(firstTopic.TopicId, firstReply.ReplyId); Assert.IsNotNull(reply, "Reply should not be null."); Assert.AreEqual(firstReply.Message, reply.Message, "TopicReply.Message should be the same."); }
public void GroupsDiscussRepliesAddTest() { var topicId = "72157630982877126"; var message = "Test message reply\r\n" + DateTime.Now.ToString("o"); var newMessage = "New Message reply\r\n" + DateTime.Now.ToString("o"); AuthInstance.GroupsDiscussRepliesAdd(topicId, message); var topicReplies = AuthInstance.GroupsDiscussRepliesGetList(topicId, 1, 100); var reply = topicReplies.FirstOrDefault(r => r.Message == message); Assert.IsNotNull(reply, "Cannot find matching message."); AuthInstance.GroupsDiscussRepliesEdit(topicId, reply.ReplyId, newMessage); var reply2 = AuthInstance.GroupsDiscussRepliesGetInfo(topicId, reply.ReplyId); Assert.AreEqual(newMessage, reply2.Message, "Message should have been updated."); AuthInstance.GroupsDiscussRepliesDelete(topicId, reply.ReplyId); topicReplies = AuthInstance.GroupsDiscussRepliesGetList(topicId, 1, 100); var reply3 = topicReplies.FirstOrDefault(r => r.ReplyId == reply.ReplyId); Assert.IsNull(reply3, "Reply should not exist anymore."); }