Exemplo n.º 1
0
        public void BuildUrl_Throws_On_Null_Param_Dictionary()
        {
            var dmReqProc = new DirectMessageRequestProcessor <DirectMessage> {
                BaseUrl = "https://api.twitter.com/1/"
            };

            var ex = L2TAssert.Throws <ArgumentException>(() => dmReqProc.BuildUrl(null));

            Assert.AreEqual("Type", ex.ParamName);
        }
Exemplo n.º 2
0
        public void BuildUrl_Throws_On_Missing_Type_Param()
        {
            var dmReqProc = new DirectMessageRequestProcessor <DirectMessage> {
                BaseUrl = "https://api.twitter.com/1/"
            };
            var parameters = new Dictionary <string, string>();

            var ex = L2TAssert.Throws <ArgumentException>(() => dmReqProc.BuildUrl(parameters));

            Assert.AreEqual("Type", ex.ParamName);
        }
        public void BuildUrl_Constructs_Show_Url()
        {
            var dmReqProc = new DirectMessageRequestProcessor<DirectMessage> { BaseUrl = "https://api.twitter.com/1/" };
            const string Expected = "https://api.twitter.com/1/direct_messages/show.json?id=478805447";
            var parameters =
                new Dictionary<string, string>
                {
                        { "Type", ((int)DirectMessageType.Show).ToString(CultureInfo.InvariantCulture) },
                        { "ID", "478805447" },
                };

            Request req = dmReqProc.BuildUrl(parameters);

            Assert.Equal(Expected, req.FullUrl);
        }
Exemplo n.º 4
0
        public void BuildUrl_Show_Requires_ID()
        {
            var dmReqProc = new DirectMessageRequestProcessor <DirectMessage> {
                BaseUrl = "https://api.twitter.com/1/"
            };
            var parameters =
                new Dictionary <string, string>
            {
                { "Type", ((int)DirectMessageType.Show).ToString(CultureInfo.InvariantCulture) },
                //{ "ID", "478805447" },
            };

            var ex = L2TAssert.Throws <ArgumentNullException>(() => dmReqProc.BuildUrl(parameters));

            Assert.AreEqual("ID", ex.ParamName);
        }
Exemplo n.º 5
0
        public void BuildUrl_Constructs_Show_Url()
        {
            var dmReqProc = new DirectMessageRequestProcessor <DirectMessage> {
                BaseUrl = "https://api.twitter.com/1/"
            };
            const string Expected   = "https://api.twitter.com/1/direct_messages/show.json?id=478805447";
            var          parameters =
                new Dictionary <string, string>
            {
                { "Type", ((int)DirectMessageType.Show).ToString(CultureInfo.InvariantCulture) },
                { "ID", "478805447" },
            };

            Request req = dmReqProc.BuildUrl(parameters);

            Assert.AreEqual(Expected, req.FullUrl);
        }
        public void BuildUrl_Constructs_SentBy_Url()
        {
            var dmReqProc = new DirectMessageRequestProcessor<DirectMessage> { BaseUrl = "https://api.twitter.com/1/" };
            const string Expected = "https://api.twitter.com/1/direct_messages/sent.json?since_id=1234567&max_id=357&page=1&count=2&include_entities=true";
            var parameters =
                new Dictionary<string, string>
                {
                        { "Type", ((int)DirectMessageType.SentBy).ToString(CultureInfo.InvariantCulture) },
                        { "SinceID", "1234567" },
                        { "MaxID", "357" },
                        { "Page", "1" },
                        { "Count", "2" },
                        { "IncludeEntities", true.ToString() }
                };

            Request req = dmReqProc.BuildUrl(parameters);

            Assert.Equal(Expected, req.FullUrl);
        }
Exemplo n.º 7
0
        public void BuildUrl_Constructs_SentBy_Url()
        {
            var dmReqProc = new DirectMessageRequestProcessor <DirectMessage> {
                BaseUrl = "https://api.twitter.com/1/"
            };
            const string Expected   = "https://api.twitter.com/1/direct_messages/sent.json?since_id=1234567&max_id=357&page=1&count=2&include_entities=true";
            var          parameters =
                new Dictionary <string, string>
            {
                { "Type", ((int)DirectMessageType.SentBy).ToString(CultureInfo.InvariantCulture) },
                { "SinceID", "1234567" },
                { "MaxID", "357" },
                { "Page", "1" },
                { "Count", "2" },
                { "IncludeEntities", true.ToString() }
            };

            Request req = dmReqProc.BuildUrl(parameters);

            Assert.AreEqual(Expected, req.FullUrl);
        }
        public void BuildUrl_Show_Requires_ID()
        {
            var dmReqProc = new DirectMessageRequestProcessor<DirectMessage> { BaseUrl = "https://api.twitter.com/1/" };
            var parameters =
                new Dictionary<string, string>
                {
                        { "Type", ((int)DirectMessageType.Show).ToString(CultureInfo.InvariantCulture) },
                        //{ "ID", "478805447" },
                };

            ArgumentNullException ex = L2TAssert.Throws<ArgumentNullException>(() => dmReqProc.BuildUrl(parameters));

            Assert.AreEqual("ID", ex.ParamName);
        }
        public void BuildUrl_Throws_On_Null_Param_Dictionary()
        {
            var dmReqProc = new DirectMessageRequestProcessor<DirectMessage> { BaseUrl = "https://api.twitter.com/1/" };

            ArgumentException ex = L2TAssert.Throws<ArgumentException>(() => dmReqProc.BuildUrl(null));

            Assert.AreEqual("Type", ex.ParamName);
        }
        public void BuildUrl_Throws_On_Missing_Type_Param()
        {
            var dmReqProc = new DirectMessageRequestProcessor<DirectMessage> { BaseUrl = "https://api.twitter.com/1/" };
            var parameters = new Dictionary<string, string>();

            ArgumentException ex = L2TAssert.Throws<ArgumentException>(() => dmReqProc.BuildUrl(parameters));

            Assert.AreEqual("Type", ex.ParamName);
        }