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 p = new 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.IsNotNullOrEmpty(page.Entry.Poster.Username); }
public static MapLayer MapLayerFactory(WorldMap map, XmlReader r) { for (int i = 0; i < r.AttributeCount; i++) { r.MoveToAttribute(i); if (r.Name == "Type") { LayerParser factory = layerParsers[r.Value]; if (factory != null) { return(factory(map, r)); } } } return(null); }
private void BuildCompositionLayer() { _compositionLayer = new CompositionLayer(this, LayerParser.Parse(_composition), _composition.Layers, _composition); }
public static void RegisterLayerParser(string typeName, LayerParser parser) { layerParsers.Add(typeName, parser); }