public void ParsesTestPage() { string content = TestingShared.GetFileContent("testpage_247911.xml"); LayerParser p = new LayerParser(); EntryPage page = p.ParseAsAnEntryPage(content); Assert.IsNotNull(page); Assert.IsNotNull(page.Replies); // Has userpic. Userpic userpic = page.Entry.PosterUserpic; Assert.IsNotNull(userpic); // Comment deserialization Comment firstComment = page.Replies.Comments[0]; Assert.AreEqual(91506535, firstComment.Id); Assert.IsTrue(firstComment.IsFull, "By default a comment is treated as full."); Assert.AreEqual(new DateTime(2015, 6, 25, 15, 16, 50), firstComment.Date.Value); Assert.AreEqual("1", firstComment.Text); Comment innerComment = firstComment.Replies.Comments[0]; Assert.AreEqual("http://galkovsky.livejournal.com/247911.html?thread=91589479#t91589479", innerComment.Url); // Entry text deserialization string entryText = page.Entry.Text; Assert.IsTrue(entryText.StartsWith("<p><center><img")); }
public void LoadHtml() { string content = TestingShared.GetFileContent("testpage_247911.xml"); LayerParser.LayerParser p = new LayerParser.LayerParser(); _html = p.ParseAsAnEntryPage(content) .Entry.Text; _ex = new FileUrlExtractor(); }
public void StoresUserpic() { string content = TestingShared.GetFileContent("testpage_247911.xml"); LayerParser p = new LayerParser(); EntryPage page = p.ParseAsAnEntryPage(content); page.Replies.Comments.Clear(); string serialized = p.Serialize(page); Assert.IsTrue(serialized.Contains("<userpic ")); }
public void StoresUsername() { string content = TestingShared.GetFileContent("testpage_247911.xml"); LayerParser p = new LayerParser(); EntryPage page = p.ParseAsAnEntryPage(content); page.Replies.Comments.Clear(); string serialized = p.Serialize(page); page = p.ParseAsAnEntryPage(serialized); Assert.That(page.Entry.Poster.Username, Is.Not.Null.And.Not.Empty); }