public void BuildURLTestMissingScreenName() { ListRequestProcessor <List> target = new ListRequestProcessor <List> { BaseUrl = "https://api.twitter.com/1/" }; Dictionary <string, string> parameters = new Dictionary <string, string> { { "Type", "0" }, }; string expected = "https://api.twitter.com/1/JoeMayo/lists.xml"; string actual = target.BuildURL(parameters); Assert.AreEqual(expected, actual); }
public void NullParametersTest() { ListRequestProcessor <List> target = new ListRequestProcessor <List> { BaseUrl = "https://api.twitter.com/1/" }; Dictionary <string, string> parameters = null; string actual; try { actual = target.BuildURL(parameters); Assert.Fail("Expected ArgumentException."); } catch (ArgumentException ae) { Assert.AreEqual <string>("Type", ae.ParamName); } }
public void BuildStatusUrlTestWithParameters() { ListRequestProcessor <List> target = new ListRequestProcessor <List>() { BaseUrl = "https://api.twitter.com/1/" }; var parameters = new Dictionary <string, string> { { "Type", ((int)ListType.Statuses).ToString() }, { "ScreenName", "JoeMayo" }, { "ListID", "1234567" }, { "MaxID", "9876543" }, { "SinceID", "2345678" }, { "PerPage", "100" }, { "Page", "2" } }; string expected = "https://api.twitter.com/1/JoeMayo/lists/1234567/statuses.xml?max_id=9876543&since_id=2345678&per_page=100&page=2"; string actual = target.BuildURL(parameters); Assert.AreEqual(expected, actual); }
public void NullParametersTest() { ListRequestProcessor<List> target = new ListRequestProcessor<List> { BaseUrl = "https://api.twitter.com/1/" }; Dictionary<string, string> parameters = null; string actual; try { actual = target.BuildURL(parameters); Assert.Fail("Expected ArgumentException."); } catch (ArgumentException ae) { Assert.AreEqual<string>("Type", ae.ParamName); } }
public void BuildURLTestMissingType() { ListRequestProcessor<List> target = new ListRequestProcessor<List> { BaseUrl = "https://api.twitter.com/1/" }; Dictionary<string, string> parameters = new Dictionary<string, string> { { "ScreenName", "JoeMayo" } }; string expected = "https://api.twitter.com/1/JoeMayo/lists.xml"; string actual = target.BuildURL(parameters); Assert.AreEqual(expected, actual); }
public void BuildStatusUrlTestWithParameters() { ListRequestProcessor<List> target = new ListRequestProcessor<List>() { BaseUrl = "https://api.twitter.com/1/" }; var parameters = new Dictionary<string, string> { {"Type", ((int) ListType.Statuses).ToString()}, {"ScreenName", "JoeMayo"}, {"ListID", "1234567"}, {"MaxID", "9876543"}, {"SinceID", "2345678"}, {"PerPage", "100"}, {"Page", "2"} }; string expected = "https://api.twitter.com/1/JoeMayo/lists/1234567/statuses.xml?max_id=9876543&since_id=2345678&per_page=100&page=2"; string actual = target.BuildURL(parameters); Assert.AreEqual(expected, actual); }