public void CreateFromAtomXml_OutOfLine_Success() { StringBuilder xml = new StringBuilder(); xml.Append(string.Format("<atom:content type='{0}' src='{1}' xmlns:atom='http://www.w3.org/2005/Atom' />", ValidTypeImage, ValidSourceUri)); XmlDocument doc = UtilityTestXml.CreateDocument(xml.ToString()); XmlNamespaceManager nsManager = UtilityTestXml.CreateAtomNamespaceManager(doc); AtomContentFactory factory = new AtomContentFactory(); Content newContent = factory.CreateFromAtomXml(doc.DocumentElement, nsManager); Assert.AreEqual(ValidTypeImage, newContent.ContentType); Assert.IsEmpty(newContent.Text); Assert.AreEqual(ValidSourceUri, newContent.SourceUri); Assert.IsTrue(newContent.IsExternallySourced); }
public void CreateFromAtomXml_UnrecognizedFormat_Empty() { XmlDocument doc = UtilityTestXml.CreateDocument(TestConstants.UnrecognizableXml); XmlNamespaceManager nsManager = UtilityTestXml.CreateAtomNamespaceManager(doc); AtomContentFactory factory = new AtomContentFactory(); Content newContent = factory.CreateFromAtomXml(doc.DocumentElement, nsManager); Assert.IsNotNull(newContent); Assert.IsEmpty(newContent.ContentType); }