예제 #1
0
        public void GroupsDiscussTopicsGetListTest()
        {
            var topics = AuthInstance.GroupsDiscussTopicsGetList(TestData.GroupId, 1, 10);

            Assert.IsNotNull(topics, "Topics should not be null.");

            Assert.AreEqual(TestData.GroupId, topics.GroupId, "GroupId should be the same.");
            Assert.AreNotEqual(0, topics.Count, "Should be more than one topics return.");
            Assert.AreEqual(10, topics.Count, "Count should be 10.");

            foreach (var topic in topics)
            {
                Assert.IsNotNull(topic.TopicId, "TopicId should not be null.");
                Assert.IsNotNull(topic.Subject, "Subject should not be null.");
                Assert.IsNotNull(topic.Message, "Message should not be null.");
            }

            var firstTopic = topics.First();

            var secondTopic = AuthInstance.GroupsDiscussTopicsGetInfo(firstTopic.TopicId);

            Assert.AreEqual(firstTopic.TopicId, secondTopic.TopicId, "TopicId's should be the same.");
            Assert.AreEqual(firstTopic.Subject, secondTopic.Subject, "Subject's should be the same.");
            Assert.AreEqual(firstTopic.Message, secondTopic.Message, "Message's should be the same.");
            Assert.AreEqual(firstTopic.DateCreated, secondTopic.DateCreated, "DateCreated's should be the same.");
            Assert.AreEqual(firstTopic.DateLastPost, secondTopic.DateLastPost, "DateLastPost's should be the same.");
        }
예제 #2
0
        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.");
        }
예제 #3
0
        public void GroupsDiscussTopicsAddTest()
        {
            var groupId = TestData.FlickrNetTestGroupId;

            var subject = "Test subject line: " + DateTime.Now.ToString("o");
            var message = "Subject message line.";

            AuthInstance.GroupsDiscussTopicsAdd(groupId, subject, message);

            var topics = AuthInstance.GroupsDiscussTopicsGetList(groupId, 1, 5);

            var topic = topics.SingleOrDefault(t => t.Subject == subject);

            Assert.IsNotNull(topic, "Unable to find topic with matching subject line.");

            Assert.AreEqual(message, topic.Message, "Message should be the same.");
        }
예제 #4
0
        public void GroupsDiscussTopicsGetListEditableTest()
        {
            var groupId = "51035612836@N01"; // Flickr API group

            var topics = AuthInstance.GroupsDiscussTopicsGetList(groupId, 1, 20);

            Assert.AreNotEqual(0, topics.Count);

            foreach (var topic in topics)
            {
                Assert.IsTrue(topic.CanEdit, "CanEdit should be true.");
                if (!topic.IsLocked)
                {
                    Assert.IsTrue(topic.CanReply, "CanReply should be true.");
                }
                Assert.IsTrue(topic.CanDelete, "CanDelete should be true.");
            }
        }