public void TestFixtureSetup() { var xs = new XmlSerializer(typeof(DblTextMetadata <DblMetadataLanguage>)); using (TextReader reader = new StringReader(TestXml)) m_metadata = (DblTextMetadata <DblMetadataLanguage>)xs.Deserialize(reader); }
public void Load_FileDoesNotExist_HandlesException() { Exception exception; DblTextMetadata <DblMetadataLanguage> .Load <DblTextMetadata <DblMetadataLanguage> >("", out exception); Assert.NotNull(exception); }
public void Load_Successful() { using (var metadataFile = new TempFile()) { File.WriteAllText(metadataFile.Path, Resources.metadata_xml); Exception exception; DblTextMetadata <DblMetadataLanguage> .Load <DblTextMetadata <DblMetadataLanguage> >(metadataFile.Path, out exception); Assert.Null(exception); } }
public void TestFixtureSetup() { var xs = new XmlSerializer(typeof(DblTextMetadata<DblMetadataLanguage>)); using (TextReader reader = new StringReader(TestXml)) m_metadata = (DblTextMetadata<DblMetadataLanguage>)xs.Deserialize(reader); }
public void Serialize() { var metadata = new DblTextMetadata<DblMetadataLanguage> { Id = "id", Revision = 1, Identification = new DblMetadataIdentification { Name = "name", SystemIds = new HashSet<DblMetadataSystemId> { new DblMetadataSystemId { Type = "type", Id = "Idvalue" } } }, Copyright = new DblMetadataCopyright { Statement = new DblMetadataXhtmlContentNode { Xhtml = @"© 2015, SIL Inc. All rights reserved." } }, Promotion = new DblMetadataPromotion { PromoVersionInfo = new DblMetadataXhtmlContentNode { Xhtml = @"<h1>Acholi New Testament 1985</h1><p>More text</p>" }, PromoEmail = new DblMetadataXhtmlContentNode { Xhtml = "<p>Email Text</p>" } }, ArchiveStatus = new DblMetadataArchiveStatus { DateArchived = "dateArchived" } }; const string expectedResult = @"<?xml version=""1.0"" encoding=""utf-16""?> <DBLMetadata id=""id"" revision=""1""> <identification> <name>name</name> <systemId type=""type"">Idvalue</systemId> </identification> <copyright> <statement contentType=""xhtml"">© 2015, SIL Inc. All rights reserved.</statement> </copyright> <promotion> <promoVersionInfo contentType=""xhtml""> <h1>Acholi New Testament 1985</h1> <p>More text</p> </promoVersionInfo> <promoEmail contentType=""xhtml""> <p>Email Text</p> </promoEmail> </promotion> <archiveStatus> <dateArchived>dateArchived</dateArchived> </archiveStatus> </DBLMetadata>"; AssertThatXmlIn.String(expectedResult).EqualsIgnoreWhitespace(metadata.GetAsXml()); }
public void Serialize() { var metadata = new DblTextMetadata <DblMetadataLanguage> { Id = "id", Revision = 1, Identification = new DblMetadataIdentification { Name = "name", SystemIds = new HashSet <DblMetadataSystemId> { new DblMetadataSystemId { Type = "type", Id = "Idvalue" } } }, Copyright = new DblMetadataCopyright { Statement = new DblMetadataXhtmlContentNode { Xhtml = @"© 2015, SIL Inc. All rights reserved." } }, Promotion = new DblMetadataPromotion { PromoVersionInfo = new DblMetadataXhtmlContentNode { Xhtml = @"<h1>Acholi New Testament 1985</h1><p>More text</p>" }, PromoEmail = new DblMetadataXhtmlContentNode { Xhtml = "<p>Email Text</p>" } }, ArchiveStatus = new DblMetadataArchiveStatus { DateArchived = "dateArchived" } }; const string expectedResult = @"<?xml version=""1.0"" encoding=""utf-16""?> <DBLMetadata id=""id"" revision=""1""> <identification> <name>name</name> <systemId type=""type"">Idvalue</systemId> </identification> <copyright> <statement contentType=""xhtml"">© 2015, SIL Inc. All rights reserved.</statement> </copyright> <promotion> <promoVersionInfo contentType=""xhtml""> <h1>Acholi New Testament 1985</h1> <p>More text</p> </promoVersionInfo> <promoEmail contentType=""xhtml""> <p>Email Text</p> </promoEmail> </promotion> <archiveStatus> <dateArchived>dateArchived</dateArchived> </archiveStatus> </DBLMetadata>"; AssertThatXmlIn.String(expectedResult).EqualsIgnoreWhitespace(metadata.GetAsXml()); }