public void ExportSemanticDomains()
{
using (var exportDlg = new ExportDialog())
{
exportDlg.SetCache(m_cache);
var tempPath = Path.GetTempFileName();
var fxt = new ExportDialog.FxtType();
fxt.m_sXsltFiles = "SemDomQs.xsl";
var fxtPath = Path.Combine(exportDlg.FxtDirectory, "SemDomQs.xml");
var wss = new List<int>();
wss.Add(m_cache.LanguageWritingSystemFactoryAccessor.GetWsFromStr("en"));
exportDlg.SetTranslationWritingSystems(wss);
exportDlg.ExportSemanticDomains(new DummyProgressDlg(), new object[] {tempPath, fxt, fxtPath, false});
string result;
using (var reader = new StreamReader(tempPath, Encoding.UTF8))
result = reader.ReadToEnd();
File.Delete(tempPath);
Assert.That(result, Is.StringContaining("What words refer to the sun?"));
Assert.That(result, Is.Not.StringContaining("1.1.1.11.1.1.1"), "should not output double abbr for en");
Assert.That(result, Is.Not.StringContaining("class: english"),
"English should not give anything the missing translation style");
wss.Clear();
wss.Add(m_cache.LanguageWritingSystemFactoryAccessor.GetWsFromStr("fr"));
exportDlg.ExportSemanticDomains(new DummyProgressDlg(), new object[] {tempPath, fxt, fxtPath, false});
using (var reader = new StreamReader(tempPath, Encoding.UTF8))
result = reader.ReadToEnd();
File.Delete(tempPath);
Assert.That(result, Is.Not.StringContaining("What words refer to the sun?"),
"french export should not have english questions");
Assert.That(result, Is.StringContaining("<p class=\"quest1\" lang=\"fr\">(1) Quels mots se"),
"French export should have the French question (not english class)");
exportDlg.ExportSemanticDomains(new DummyProgressDlg(), new object[] {tempPath, fxt, fxtPath, true});
using (var reader = new StreamReader(tempPath, Encoding.UTF8))
result = reader.ReadToEnd();
File.Delete(tempPath);
Assert.That(result, Is.StringContaining("<span class=\"english\" lang=\"en\">(1) What words refer to the sun?"),
"french export with all questions should have english where french is missing (in red)");
Assert.That(result, Is.StringContaining("<p class=\"quest1\" lang=\"fr\">(1) Quels mots se"),
"French export should have the French question (not red)");
Assert.That(result, Is.Not.StringContaining("What words refer to everything we can see"),
"French export should not have English alternative where French is present");
}
}