public void ProcessResults_Retains_Original_Input_Parameters()
        {
            var blockedReqProc = new BlocksRequestProcessor<Blocks>
            {
                Type = BlockingType.List,
                ScreenName = "somename",
                Page = 1,
                PerPage = 10,
                IncludeEntities = true,
                SkipStatus = true,
                Cursor = "789"
            };

            var blocks = blockedReqProc.ProcessResults(BlockedUsersJson);

            Assert.IsNotNull(blocks);
            Assert.IsNotNull(blocks.SingleOrDefault());
            var block = blocks.Single();
            Assert.AreEqual(BlockingType.List, block.Type);
            Assert.AreEqual("somename", block.ScreenName);
            Assert.AreEqual(1, block.Page);
            Assert.AreEqual(10, block.PerPage);
            Assert.IsTrue(block.IncludeEntities);
            Assert.IsTrue(block.SkipStatus);
            Assert.AreEqual("789", block.Cursor);
        }
        public void ProcessResults_Retains_Original_Input_Parameters()
        {
            var blockedReqProc = new BlocksRequestProcessor <Blocks>
            {
                Type            = BlockingType.List,
                ScreenName      = "somename",
                Page            = 1,
                PerPage         = 10,
                IncludeEntities = true,
                SkipStatus      = true,
                Cursor          = "789"
            };

            var blocks = blockedReqProc.ProcessResults(BlockedUsersJson);

            Assert.IsNotNull(blocks);
            Assert.IsNotNull(blocks.SingleOrDefault());
            var block = blocks.Single();

            Assert.AreEqual(BlockingType.List, block.Type);
            Assert.AreEqual("somename", block.ScreenName);
            Assert.AreEqual(1, block.Page);
            Assert.AreEqual(10, block.PerPage);
            Assert.IsTrue(block.IncludeEntities);
            Assert.IsTrue(block.SkipStatus);
            Assert.AreEqual("789", block.Cursor);
        }
        public void ProcessResults_Returns_Empty_Collection_When_Empty_Results()
        {
            var blocksReqProc = new BlocksRequestProcessor<Blocks> { BaseUrl = "https://api.twitter.com/1.1/" };

            var blocks = blocksReqProc.ProcessResults(string.Empty);

            Assert.AreEqual(1, blocks.Count);
        }
        public void ProcessResults_Returns_Empty_Collection_When_Empty_Results()
        {
            var blocksReqProc = new BlocksRequestProcessor <Blocks> {
                BaseUrl = "https://api.twitter.com/1.1/"
            };

            var blocks = blocksReqProc.ProcessResults(string.Empty);

            Assert.AreEqual(1, blocks.Count);
        }
Exemple #5
0
        public void ProcessIdsResultsTest()
        {
            BlocksRequestProcessor <Blocks> target = new BlocksRequestProcessor <Blocks>();
            XElement twitterResponse = XElement.Parse(m_blockedUsersXml);
            IList    actual          = target.ProcessResults(twitterResponse);
            var      actualQuery     = actual as IList <Blocks>;

            Assert.IsNotNull(actualQuery);
            Assert.AreEqual(actualQuery[0].Users.Count, 2);
        }
Exemple #6
0
        public void ProcessExistsResultsTest()
        {
            BlocksRequestProcessor target = new BlocksRequestProcessor();
            XElement twitterResponse      = XElement.Parse(m_blockExistsXml);
            IList    actual      = target.ProcessResults(twitterResponse);
            var      actualQuery = actual as IList <Blocks>;

            Assert.IsNotNull(actualQuery);
            Assert.AreEqual(actualQuery.Count(), 1);
        }
        public void ProcessResults_Handles_BlockedUsers()
        {
            var blockedReqProc = new BlocksRequestProcessor<Blocks>
            {
                Type = BlockingType.List
            };

            IList actual = blockedReqProc.ProcessResults(BlockedUsersJson);

            var actualQuery = actual as IList<Blocks>;
            Assert.IsNotNull(actualQuery);
            Assert.AreEqual(actualQuery[0].Users.Count, 3);
        }
        public void ProcessResults_Handles_BlockedUsers()
        {
            var blockedReqProc = new BlocksRequestProcessor <Blocks>
            {
                Type = BlockingType.List
            };

            IList actual = blockedReqProc.ProcessResults(BlockedUsersJson);

            var actualQuery = actual as IList <Blocks>;

            Assert.IsNotNull(actualQuery);
            Assert.AreEqual(actualQuery[0].Users.Count, 3);
        }
        public void ProcessResults_Handles_IDs()
        {
            var blockReqProc = new BlocksRequestProcessor<Blocks>
            {
                Type = BlockingType.Ids
            };

            IList<Blocks> blocksResponse = blockReqProc.ProcessResults(BlockedIDsJson);

            Assert.IsNotNull(blocksResponse);
            Blocks blocks = blocksResponse.First();
            List<string> ids = blocks.IDs;
            Assert.AreEqual(5, ids.Count());
            Assert.AreEqual("35080286", ids.First());
        }
        public void ProcessResults_Handles_IDs()
        {
            var blockReqProc = new BlocksRequestProcessor <Blocks>
            {
                Type = BlockingType.Ids
            };

            IList <Blocks> blocksResponse = blockReqProc.ProcessResults(BlockedIDsJson);

            Assert.IsNotNull(blocksResponse);
            Blocks        blocks = blocksResponse.First();
            List <string> ids    = blocks.IDs;

            Assert.AreEqual(5, ids.Count());
            Assert.AreEqual("35080286", ids.First());
        }
        public void ProcessIdsResultsTest()
        {
            BlocksRequestProcessor<Blocks> target = new BlocksRequestProcessor<Blocks>();
            XElement twitterResponse = XElement.Parse(m_blockedUsersXml);
            IList actual = target.ProcessResults(twitterResponse);
            var actualQuery = actual as IList<Blocks>;

            Assert.IsNotNull(actualQuery);
            Assert.AreEqual(actualQuery[0].Users.Count, 2);
        }