Example #1
0
        public void XhtmlTest()
        {
            Pdf    target   = new Pdf(_tf.Copy("T1.xhtml"), _tf.Copy("T1.css"));
            string expected = _tf.Output("T1.xhtml");
            string actual   = target.Xhtml;

            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public void UpdateProductTest()
        {
            var        result    = UpdateProduct(_tf.Input("Pathway.wxs"), "1.13.4.4658", "BTE");
            const bool overwrite = true;

            File.Copy(result, _tf.Output("Pathway.wxs"), overwrite);
            File.Delete(result);
            XmlAssert.AreEqual(_tf.Expected("Pathway.wxs"), _tf.Output("Pathway.wxs"), "Pathway Product File mismatch on insert");
        }
Example #3
0
        public void AddChaptersTest()
        {
            const string fileName       = "DEU.SFM";
            string       inputFullName  = _testFiles.Input(fileName);
            string       outputFullName = _testFiles.SubOutput("SFM", fileName);

            File.Copy(inputFullName, outputFullName);
            PartialBooks.AddChapters(_testFiles.Output("SFM"));
            TextFileAssert.AreEqual(_testFiles.Expected(fileName), outputFullName);
        }
Example #4
0
        public void ProcessTreeTest()
        {
            if (Common.IsUnixOS())
            {
                return;
            }
            ResetIds();
            var inputGuids = _tf.Input("FileLibrary.xml");

            LoadGuids(inputGuids);
            ApplicationFileName = "Application.wxs";
            DirectoryInfo directoryInfo = new DirectoryInfo(_tf.Input(@"output\Release"));

            foreach (DirectoryInfo directory in directoryInfo.GetDirectories())
            {
                ResetFileComponents();
                ProcessTree((XmlElement)XDoc.SelectSingleNode("//*[@Id='APPLICATIONFOLDER']"), directory.FullName);
                AddFeatures();
            }

            // Check File & Features Match
            var actualPath = _tf.Output("Application.wxs");
            var writer     = XmlTextWriter.Create(actualPath, new XmlWriterSettings {
                Indent = true, Encoding = Encoding.UTF8
            });

            XDoc.WriteTo(writer);
            writer.Close();
            XmlAssert.AreEqual(_tf.Expected("Application.wxs"), actualPath, "File Feature format changed");

            // Check no Guids created
            var actualGuids = _tf.Output("FileLibrary.xml");

            SaveGuids(actualGuids);
            XmlAssert.AreEqual(inputGuids, actualGuids, "Guids changed");
        }
Example #5
0
        public void VernacularNameTest()
        {
            const string sKey        = @"Software\SIL\Pathway";
            const string keyName     = "WritingSystemStore";
            var          lgFullPath  = _testFiles.Output("seh.ldml");
            var          lgDirectory = Path.GetDirectoryName(lgFullPath);

            Debug.Assert(!string.IsNullOrEmpty(lgDirectory));
            RegistryKey oKey  = Registry.CurrentUser.OpenSubKey(sKey, true);
            RegistryKey myKey = oKey ?? Registry.CurrentUser.CreateSubKey(sKey);

            Debug.Assert(myKey != null);
            var oVal = (oKey == null) ? null : oKey.GetValue(keyName, null);

            myKey.SetValue(keyName, lgDirectory);
            var wr = new StreamWriter(lgFullPath);

            wr.Write(@"<?xml version=""1.0"" encoding=""utf-8""?>
                <ldml><special xmlns:palaso=""urn://palaso.org/ldmlExtensions/v1"">
                        <palaso:languageName value=""Sena"" />
                </special></ldml>");
            wr.Close();
            PublicationInformation projInfo = new PublicationInformation();

            projInfo.DefaultXhtmlFileWithPath = _testFiles.Input("sena3-imba.xhtml");
            projInfo.IsLexiconSectionExist    = true;
            var input  = new DictionaryForMIDsInput(projInfo);
            var result = input.VernacularName();

            if (oKey == null)
            {
                Registry.CurrentUser.DeleteSubKey(sKey);
            }
            else if (oVal == null)
            {
                oKey.DeleteValue(keyName);
            }
            else
            {
                oKey.SetValue(keyName, oVal);
            }
            Assert.AreEqual("Sena", result);
        }