public void EntryMakeItToPLift() { var xmlOfEntries = @" <entry id='foo1'> <lexical-unit><form lang='qaa-x-qaa'><text>hello</text></form></lexical-unit> </entry>" ; using (var p = new WeSay.Project.Tests.ProjectDirectorySetupForTesting(xmlOfEntries)) { PLiftMaker maker = new PLiftMaker(); using (var project = p.CreateLoadedProject()) { using (var repository = project.GetLexEntryRepository()) { string outputPath = Path.Combine(project.PathToExportDirectory, project.Name + ".xhtml"); maker.MakePLiftTempFile(outputPath, repository, project.DefaultPrintingTemplate, LiftWriter.ByteOrderStyle.BOM); AssertThatXmlIn.File(outputPath). HasAtLeastOneMatchForXpath("//field[@type='headword']/form[@lang='qaa-x-qaa']/text[text()='hello']"); } } } }
public void MakePLiftTempFile_ExportPartOfSpeechAsGrammaticalInfoElementSpecified_GrammaticalInfoOutputAsElement() { var xmlOfEntries = @" <entry id='foo1'> <sense><grammatical-info value='noun'></grammatical-info></sense> </entry>" ; using (var p = new WeSay.Project.Tests.ProjectDirectorySetupForTesting(xmlOfEntries)) { PLiftMaker maker = new PLiftMaker() { Options = PLiftExporter.DefaultOptions | PLiftExporter.Options.ExportPartOfSpeechAsGrammaticalInfoElement };; using (var project = p.CreateLoadedProject()) { using (var repository = project.GetLexEntryRepository()) { string outputPath = Path.Combine(project.PathToExportDirectory, project.Name + ".plift"); maker.MakePLiftTempFile(outputPath, repository, project.DefaultPrintingTemplate, LiftWriter.ByteOrderStyle.BOM); AssertThatXmlIn.File(outputPath). HasAtLeastOneMatchForXpath("//sense/grammatical-info[@value='noun']"); } } } }