コード例 #1
0
        public void ProcessResults_Replaces_Input_Params_For_SentBy_And_SentTo()
        {
            const ulong SinceID    = 1;
            const ulong MaxID      = 2;
            const int   Page       = 3;
            const int   Count      = 4;
            const ulong ID         = 5;
            const bool  SkipStatus = true;

            var dmReqProc = new DirectMessageRequestProcessor <DirectMessage>
            {
                BaseUrl    = "https://api.twitter.com/1/",
                Type       = DirectMessageType.SentBy,
                SinceID    = SinceID,
                MaxID      = MaxID,
                Page       = Page,
                Count      = Count,
                ID         = ID,
                SkipStatus = SkipStatus
            };

            var dms = dmReqProc.ProcessResults(TestQueryResponse);

            var dm = dms.First();

            Assert.AreEqual(SinceID, dm.SinceID);
            Assert.AreEqual(MaxID, dm.MaxID);
            Assert.AreEqual(Page, dm.Page);
            Assert.AreEqual(Count, dm.Count);
            Assert.AreEqual(ID, dm.ID);
            Assert.AreEqual(SkipStatus, SkipStatus);
        }
コード例 #2
0
        public void ProcessResults_Returns_Empty_Collection_When_Empty_Results()
        {
            var dmReqProc = new DirectMessageRequestProcessor <DirectMessage> {
                BaseUrl = "https://api.twitter.com/1/"
            };

            var dms = dmReqProc.ProcessResults(string.Empty);

            Assert.IsFalse(dms.Any());
        }
コード例 #3
0
        public void ProcessResults_Handles_Single_Result_For_Show()
        {
            var dmReqProc = new DirectMessageRequestProcessor <DirectMessage>
            {
                BaseUrl = "https://api.twitter.com/1/",
                Type    = DirectMessageType.Show
            };

            var dms = dmReqProc.ProcessResults(TestQuerySingleResponse);

            Assert.IsNotNull(dms.SingleOrDefault());
        }
コード例 #4
0
        public void ProcessResults_Handles_Response()
        {
            var dmReqProc = new DirectMessageRequestProcessor <DirectMessage> {
                BaseUrl = "https://api.twitter.com/1/"
            };

            var actual = dmReqProc.ProcessResults(TestQueryResponse);

            var actualQuery = actual as IList <DirectMessage>;

            Assert.IsNotNull(actualQuery);
            Assert.AreEqual(1, actualQuery.Count());
        }
コード例 #5
0
        public void ProcessResultsTest()
        {
            var dmProc = new DirectMessageRequestProcessor <DirectMessage>()
            {
                BaseUrl = "http://twitter.com/"
            };
            XElement twitterResponse = XElement.Load(new StringReader(m_testQueryResponse));
            var      actual          = dmProc.ProcessResults(twitterResponse);
            var      actualQuery     = actual as IList <DirectMessage>;

            Assert.IsNotNull(actualQuery);
            Assert.AreEqual(1, actualQuery.Count());
        }
コード例 #6
0
        public void ProcessResults_Handles_Response()
        {
            var dmReqProc = new DirectMessageRequestProcessor<DirectMessage> { BaseUrl = "https://api.twitter.com/1/" };

            List<DirectMessage> actual = dmReqProc.ProcessResults(TestQueryResponse);

            var actualQuery = actual as IList<DirectMessage>;
            Assert.IsNotNull(actualQuery);
            Assert.AreEqual(1, actualQuery.Count());
        }
コード例 #7
0
        public void ProcessResults_Replaces_Input_Params_For_SentBy_And_SentTo()
        {
            const ulong SinceID = 1;
            const ulong MaxID = 2;
            const int Page = 3;
            const int Count = 4;
            const ulong ID = 5;
            const bool SkipStatus = true;

            var dmReqProc = new DirectMessageRequestProcessor<DirectMessage>
            {
                BaseUrl = "https://api.twitter.com/1/",
                Type = DirectMessageType.SentBy,
                SinceID = SinceID,
                MaxID = MaxID,
                Page = Page,
                Count = Count,
                ID = ID,
                SkipStatus = SkipStatus
            };

            List<DirectMessage> dms = dmReqProc.ProcessResults(TestQueryResponse);

            DirectMessage dm = dms.First();

            Assert.AreEqual(SinceID, dm.SinceID);
            Assert.AreEqual(MaxID, dm.MaxID);
            Assert.AreEqual(Page, dm.Page);
            Assert.AreEqual(Count, dm.Count);
            Assert.AreEqual(ID, dm.ID);
            Assert.AreEqual(SkipStatus, SkipStatus);
        }
コード例 #8
0
        public void ProcessResults_Handles_Single_Result_For_Show()
        {
            var dmReqProc = new DirectMessageRequestProcessor<DirectMessage> 
            { 
                BaseUrl = "https://api.twitter.com/1/",
                Type = DirectMessageType.Show
            };

            List<DirectMessage> dms = dmReqProc.ProcessResults(TestQuerySingleResponse);

            Assert.IsNotNull(dms.SingleOrDefault());
        }
コード例 #9
0
        public void ProcessResults_Returns_Empty_Collection_When_Empty_Results()
        {
            var dmReqProc = new DirectMessageRequestProcessor<DirectMessage> { BaseUrl = "https://api.twitter.com/1/" };

            List<DirectMessage> dms = dmReqProc.ProcessResults(string.Empty);

            Assert.IsFalse(dms.Any());
        }
コード例 #10
0
        public void ProcessResultsTest()
        {
            var dmProc = new DirectMessageRequestProcessor<DirectMessage>() { BaseUrl = "http://twitter.com/" };
            XElement twitterResponse = XElement.Load(new StringReader(m_testQueryResponse));
            var actual = dmProc.ProcessResults(twitterResponse);
            var actualQuery = actual as IList<DirectMessage>;

            Assert.IsNotNull(actualQuery);
            Assert.AreEqual(1 ,actualQuery.Count());
        }