ExportSemanticDomains() private method

Do the export of the semantic domains list to an HTML document (which is given extension .doc since it is mainly intended to be opened as a Word document, since Word understands the 'page break before' concept). The signature of this method is required by the way it is used as the task of the ProgressDialog. See the first few lines for the required parameters.
private ExportSemanticDomains ( IThreadedProgress progressDlg, object parameters ) : object
progressDlg IThreadedProgress
parameters object
return object
Example #1
0
        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");
            }
        }