Ejemplo n.º 1
0
        public void ShouldInitializeWithoutRawResponse()
        {
            var response = new GetTopicsResponse();

            Assert.That(response.Count, Is.EqualTo(0));
            Assert.That(response.Page, Is.EqualTo(0));
            Assert.That(response.Total, Is.EqualTo(0));
        }
Ejemplo n.º 2
0
        public void ShouldInitializeWithRawResponse()
        {
            var response = new GetTopicsResponse(GetResponse());

            Assert.That(response.Count, Is.EqualTo(20));
            Assert.That(response.Page, Is.EqualTo(1));
            Assert.That(response.Total, Is.EqualTo(3));
            Assert.That(response.Topics.Count(), Is.EqualTo(3));

            AssertTopic(response.Topics.ElementAt(0), 1, "Sample :: General", "Sample Topic Description :: Information about our company", true, 1);
            AssertTopic(response.Topics.ElementAt(1), 2, "Canned Responses", "Internal responses to common questions", false, 2);
            AssertTopic(response.Topics.ElementAt(2), 3, "Sample :: Products", "Sample Topic Description :: Information about our products", true, 3);
        }
Ejemplo n.º 3
0
        public void GetTopics(long gid, int offset, int count, Action <BackendResult <TopicsInfo, ResultCode> > callback)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters["group_id"]       = gid.ToString();
            parameters["extended"]       = "1";
            parameters["preview"]        = "2";
            parameters["preview_length"] = "40";
            parameters["offset"]         = offset.ToString();
            parameters["count"]          = count.ToString();
            VKRequestsDispatcher.DispatchRequestToVK <TopicsInfo>("board.getTopics", parameters, callback, (Func <string, TopicsInfo>)(jsonStr =>
            {
                GetTopicsResponse response = JsonConvert.DeserializeObject <GenericRoot <GetTopicsResponse> >(jsonStr).response;
                return(new TopicsInfo()
                {
                    can_add_topics = response.can_add_topics,
                    profiles = response.profiles,
                    topics = response.items,
                    TotalCount = response.count,
                    groups = response.groups
                });
            }), false, true, new CancellationToken?(), null);
        }