public void TestGetStoryJsonStory() { //Testing that the following Json is returned: /* * { * "by" : "dhouston", * "descendants" : 71, * "id" : 8863, * "kids" : [ 8952, 9224, 8917, 8884, 8887, 8943, 8869, 8958, 9005, 9671, 8940, 9067, 8908, 9055, 8865, 8881, 8872, 8873, 8955, 10403, 8903, 8928, 9125, 8998, 8901, 8902, 8907, 8894, 8878, 8870, 8980, 8934, 8876 ], * "score" : 111, * "time" : 1175714200, * "title" : "My YC app: Dropbox - Throw away your USB drive", * "type" : "story", * "url" : "http://www.getdropbox.com/u/2/screencast.html" * } */ TrueLayerHackerNews.TrueLayerHackerNews trueLayerHackerNews = new TrueLayerHackerNews.TrueLayerHackerNews(); WebClient webclient = new WebClient(); RetrieveStoryModel rsm = trueLayerHackerNews.getStoryJson("8863"); Assert.AreEqual(rsm.Id, 8863); Assert.AreEqual(rsm.Descendants, 71); Assert.AreEqual(rsm.hackerNewsType, "story"); }
public void TestTypePass() { RetrieveStoryModel rsm = new RetrieveStoryModel(); rsm.hackerNewsType = "story"; Assert.IsTrue(rsm.testType()); }
public void TestDescendantsLimit() { RetrieveStoryModel rsm = new RetrieveStoryModel(); rsm.Descendants = 0; Assert.IsTrue(rsm.testDescendants()); }
public void TestDescendantsFail() { RetrieveStoryModel rsm = new RetrieveStoryModel(); rsm.Descendants = -55; Assert.IsFalse(rsm.testDescendants()); }
public void TestScoreLimit() { RetrieveStoryModel rsm = new RetrieveStoryModel(); rsm.Score = 0; Assert.IsTrue(rsm.testScore()); }
public void TestScoreFail() { RetrieveStoryModel rsm = new RetrieveStoryModel(); rsm.Score = -55; Assert.IsFalse(rsm.testScore()); }
public void TestScorePass() { RetrieveStoryModel rsm = new RetrieveStoryModel(); rsm.Score = 55; Assert.IsTrue(rsm.testScore()); }
public void TestURLFail() { RetrieveStoryModel rsm = new RetrieveStoryModel(); rsm.Url = "http:\\host/path/file"; Assert.IsFalse(rsm.testURL()); }
public void TestUrlPass() { RetrieveStoryModel rsm = new RetrieveStoryModel(); rsm.Url = "https://www.google.co.uk/"; Assert.IsTrue(rsm.testURL()); }
public void TestTypeFail() { RetrieveStoryModel rsm = new RetrieveStoryModel(); rsm.hackerNewsType = "job"; Assert.IsFalse(rsm.testType()); }
public void TestStoryFail() { RetrieveStoryModel rsm = new RetrieveStoryModel(); rsm.Url = "https://www.google.co.uk/"; rsm.Score = 55; rsm.Descendants = 55; rsm.hackerNewsType = "job"; Assert.IsFalse(rsm.testStory()); }