public void InitializeFromXml_ValidAndBogusCharacters()
        {
            IWritingSystem ws = m_wsManager.Create("en-US");

            ws.ValidChars = ksXmlHeader + "<ValidCharacters><WordForming>\u05F6\uFFFCg\uFFFC\u05F7\uFFFCh</WordForming>" +
                            "<Numeric>1</Numeric>" +
                            "<Other></Other>" +
                            "</ValidCharacters>";

            var validChars = ValidCharacters.Load(ws, RememberError);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            Assert.AreEqual(2, validCharsW.WordFormingCharacters.Count);
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("g"));
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("h"));
            Assert.AreEqual(1, validCharsW.NumericCharacters.Count);
            Assert.IsTrue(validCharsW.NumericCharacters.Contains("1"));
            Assert.AreEqual(0, validCharsW.OtherCharacters.Count);

            Assert.AreEqual("Invalid ValidChars field while loading the English (United States) writing system. " +
                            "The following characters are invalid:" +
                            Environment.NewLine + "\t\u05F6 (U+05F6)" +
                            Environment.NewLine + "\t\u05F7 (U+05F7)" +
                            Environment.NewLine + "Parameter name: xmlSrc",
                            m_lastException.Message);
        }
        public void TestInitializeFromOldValidCharsList()
        {
            ValidCharacters   validChars  = ValidCharacters.Load(" a b c d . 1 2 3", "Test WS", null);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            Assert.AreEqual(4, validCharsW.WordFormingCharacters.Count);
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("a"));
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("b"));
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("c"));
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("d"));
            Assert.AreEqual(3, validCharsW.NumericCharacters.Count);
            Assert.IsTrue(validCharsW.NumericCharacters.Contains("1"));
            Assert.IsTrue(validCharsW.NumericCharacters.Contains("2"));
            Assert.IsTrue(validCharsW.NumericCharacters.Contains("3"));
            Assert.AreEqual(2, validCharsW.OtherCharacters.Count);
            Assert.IsTrue(validCharsW.OtherCharacters.Contains(" "));
            Assert.IsTrue(validCharsW.OtherCharacters.Contains("."));

            string spaceReplacer = ReflectionHelper.GetField(typeof(ValidCharacters),
                                                             "kSpaceReplacment") as string;

            Assert.AreEqual(ksXmlHeader +
                            "<ValidCharacters><WordForming>a\uFFFCb\uFFFCc\uFFFCd</WordForming>" +
                            "<Numeric>1\uFFFC2\uFFFC3</Numeric>" +
                            "<Other>" + spaceReplacer + "\uFFFC.</Other>" +
                            "</ValidCharacters>",
                            validChars.XmlString.Replace(Environment.NewLine, string.Empty).Replace(">  <", "><"));
        }
        public void TestInitializeFromXml_NumericElementClosedTooEarly()
        {
            LanguageDefinition langDef = new LanguageDefinition();

            langDef.LocaleName    = "xmum";
            langDef.LocaleScript  = "IPA";
            langDef.LocaleCountry = "usa";
            langDef.LocaleVariant = "south";
            langDef.ValidChars    = ksXmlHeader + "<ValidCharacters><WordForming>e\uFFFCf\uFFFCg\uFFFCh</WordForming>" +
                                    "<Numeric/>4\uFFFC5" +
                                    "<Other>,\uFFFC!\uFFFC*</Other>" +
                                    "</ValidCharacters>";
            ValidCharacters   validChars  = ValidCharacters.Load(langDef);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            Assert.AreEqual(4, validCharsW.WordFormingCharacters.Count);
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("e"));
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("f"));
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("g"));
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("h"));
            Assert.AreEqual(0, validCharsW.NumericCharacters.Count);
            Assert.AreEqual(3, validCharsW.OtherCharacters.Count);
            Assert.IsTrue(validCharsW.OtherCharacters.Contains(","));
            Assert.IsTrue(validCharsW.OtherCharacters.Contains("!"));
            Assert.IsTrue(validCharsW.OtherCharacters.Contains("*"));
        }
        public void TestInitializeFromXml_BogusFormat()
        {
            LanguageDefinition langDef = new LanguageDefinition();

            langDef.LocaleName    = "xmum";
            langDef.LocaleScript  = "IPA";
            langDef.LocaleCountry = "usa";
            langDef.LocaleVariant = "south";
            langDef.ValidChars    = ksXmlHeader + "<ValidCharacters><WordForming>e\uFFFCf\uFFFCg\uFFFCh" +
                                    "</WordForming>" +
                                    "<Numeric>4\uFFFC5" +
                                    "<Other>,\uFFFC!\uFFFC*</Other>" +
                                    "</ValidCharacters>";

            ValidCharacters validChars = ValidCharacters.Load(langDef);

            VerifyDefaultWordFormingCharacters(validChars);

            Exception e = (Exception)ReflectionHelper.GetField(typeof(ValidCharacters), "s_lastException");

            Assert.AreEqual("Invalid ValidChars field while loading the xmum (IPA, usa, south) writing system:" +
                            Environment.NewLine + "\t" + langDef.ValidChars +
                            Environment.NewLine + "Parameter name: xmlSrc",
                            e.Message);
        }
        public void AddCharacter_DuplicateOfOverriddenWordFormingChar()
        {
            string sXml = ksXmlHeader +
                          "<ValidCharacters><WordForming>a\uFFFC-</WordForming>" +
                          "<Numeric/>" +
                          "<Other>{</Other>" +
                          "</ValidCharacters>";
            ValidCharacters   validChars  = ValidCharacters.Load(sXml, "Test WS", null);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            Assert.AreEqual(2, validCharsW.WordFormingCharacters.Count);
            Assert.AreEqual(0, validCharsW.NumericCharacters.Count);
            Assert.AreEqual(1, validCharsW.OtherCharacters.Count);
            Assert.IsTrue(validChars.IsWordForming("-"));
            Assert.IsFalse(validChars.IsWordForming("{"));
            validChars.AddCharacter("-");
            Assert.AreEqual(2, validCharsW.WordFormingCharacters.Count);
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("a"));
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("-"));
            Assert.IsTrue(validChars.IsWordForming("-"));
            Assert.AreEqual(0, validCharsW.NumericCharacters.Count);
            Assert.AreEqual(1, validCharsW.OtherCharacters.Count);
            Assert.IsTrue(validCharsW.OtherCharacters.Contains("{"));
            Assert.IsFalse(validChars.IsWordForming("{"));
        }
        public void TestInitializeFromXml_ValidAndBogusCharacters()
        {
            LanguageDefinition langDef = new LanguageDefinition();

            langDef.LocaleName    = "xmum";
            langDef.LocaleScript  = "IPA";
            langDef.LocaleCountry = "usa";
            langDef.LocaleVariant = "south";
            langDef.ValidChars    = ksXmlHeader + "<ValidCharacters><WordForming>\u05F6\uFFFCg\uFFFC\u05F7\uFFFCh</WordForming>" +
                                    "<Numeric>1</Numeric>" +
                                    "<Other></Other>" +
                                    "</ValidCharacters>";

            ValidCharacters   validChars  = ValidCharacters.Load(langDef);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            Assert.AreEqual(2, validCharsW.WordFormingCharacters.Count);
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("g"));
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("h"));
            Assert.AreEqual(1, validCharsW.NumericCharacters.Count);
            Assert.IsTrue(validCharsW.NumericCharacters.Contains("1"));
            Assert.AreEqual(0, validCharsW.OtherCharacters.Count);

            Exception e = (Exception)ReflectionHelper.GetField(typeof(ValidCharacters), "s_lastException");

            Assert.AreEqual("Invalid ValidChars field while loading the xmum (IPA, usa, south) writing system. " +
                            "The following characters are invalid:" +
                            Environment.NewLine + "\t\u05F6 (U+05F6)" +
                            Environment.NewLine + "\t\u05F7 (U+05F7)" +
                            Environment.NewLine + "Parameter name: xmlSrc",
                            e.Message);
        }
        public void InitializeFromXml_ValidEmptyString()
        {
            var validChars = ValidCharacters.Load(String.Empty, "Test WS", null, RememberError);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            Assert.AreEqual(0, validCharsW.WordFormingCharacters.Count);
            Assert.AreEqual(0, validCharsW.NumericCharacters.Count);
            Assert.AreEqual(0, validCharsW.OtherCharacters.Count);
            Assert.IsNull(m_lastException);
        }
        public void TestInitializeFromXml_ValidEmptyString()
        {
            ValidCharacters   validChars  = ValidCharacters.Load(String.Empty, "Test WS", null);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            Assert.AreEqual(0, validCharsW.WordFormingCharacters.Count);
            Assert.AreEqual(0, validCharsW.NumericCharacters.Count);
            Assert.AreEqual(0, validCharsW.OtherCharacters.Count);
            Assert.IsNull(ReflectionHelper.GetField(typeof(ValidCharacters), "s_lastException"));
        }
        public void InitializeFromXml_ValidNull()
        {
            var validChars = ValidCharacters.Load(null, "Test WS", null, RememberError, FwDirectoryFinder.LegacyWordformingCharOverridesFile);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            Assert.AreEqual(0, validCharsW.WordFormingCharacters.Count);
            Assert.AreEqual(0, validCharsW.NumericCharacters.Count);
            Assert.AreEqual(0, validCharsW.OtherCharacters.Count);
            Assert.IsNull(m_lastException);
        }
        public void SortAfterAddRange()
        {
            var            validChars = ValidCharacters.Load(string.Empty, "Test WS", null, null);
            IWritingSystem ws         = m_wsManager.Create("en");

            validChars.InitSortComparer(ws);
            var list = new List <string>(new[] { "z", "c", "t", "b", "8", "7", "6", "5" });

            validChars.AddCharacters(list);
            VerifySortOrder(validChars);
        }
        public void IsWordFormingChar()
        {
            var validChars = ValidCharacters.Load(ksXmlHeader +
                                                  "<ValidCharacters><WordForming>a\uFFFCb\uFFFCc\uFFFCd\uFFFCe\uFFFC#</WordForming>" +
                                                  "<Numeric></Numeric>" +
                                                  "<Other></Other>" +
                                                  "</ValidCharacters>", "Test WS", null, null, FwDirectoryFinder.LegacyWordformingCharOverridesFile);

            Assert.IsTrue(validChars.IsWordForming('#'));
            //Assert.IsTrue(validChars.IsWordForming("#"));
        }
        public void IsWordFormingChar()
        {
            ValidCharacters validChars = ValidCharacters.Load(ksXmlHeader +
                                                              "<ValidCharacters><WordForming>a\uFFFCb\uFFFCc\uFFFCd\uFFFCe\uFFFC#</WordForming>" +
                                                              "<Numeric></Numeric>" +
                                                              "<Other></Other>" +
                                                              "</ValidCharacters>", "Test WS", null);

            Assert.IsTrue(validChars.IsWordForming('#'));
            Assert.IsTrue(validChars.IsWordForming("#"));
        }
        public void InitializeFromNullString()
        {
            var validChars = ValidCharacters.Load(string.Empty, "Test WS", null, null, FwDirectoryFinder.LegacyWordformingCharOverridesFile);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            Assert.AreEqual(0, validCharsW.WordFormingCharacters.Count);
            Assert.AreEqual(0, validCharsW.NumericCharacters.Count);
            Assert.AreEqual(0, validCharsW.OtherCharacters.Count);
            Assert.AreEqual(ksXmlHeader +
                            "<ValidCharacters><WordForming /><Numeric /><Other /></ValidCharacters>",
                            validChars.XmlString.Replace(Environment.NewLine, string.Empty).Replace(">  <", "><"));
        }
        public void TestInitializeFromXml_AllowHardLineBreakCharacter()
        {
            string sXml = ksXmlHeader + "<ValidCharacters><WordForming></WordForming>" +
                          "<Numeric></Numeric>" +
                          "<Other>\u2028</Other>" +
                          "</ValidCharacters>";
            ValidCharacters   validChars  = ValidCharacters.Load(sXml, "Test WS", null);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            Assert.AreEqual(1, validCharsW.OtherCharacters.Count);
            Assert.IsTrue(validCharsW.OtherCharacters.Contains("\u2028"));
        }
        public void TestInitializeFromNullString()
        {
            ValidCharacters   validChars  = ValidCharacters.Load(string.Empty, "Test WS", null);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            Assert.AreEqual(0, validCharsW.WordFormingCharacters.Count);
            Assert.AreEqual(0, validCharsW.NumericCharacters.Count);
            Assert.AreEqual(0, validCharsW.OtherCharacters.Count);
            Assert.AreEqual(ksXmlHeader +
                            "<ValidCharacters><WordForming /><Numeric /><Other /></ValidCharacters>",
                            validChars.XmlString.Replace(Environment.NewLine, string.Empty).Replace(">  <", "><"));
        }
        public void InitializeFromXml_AllowHardLineBreakCharacter()
        {
            string sXml = ksXmlHeader + "<ValidCharacters><WordForming></WordForming>" +
                          "<Numeric></Numeric>" +
                          "<Other>\u2028</Other>" +
                          "</ValidCharacters>";
            var validChars = ValidCharacters.Load(sXml, "Test WS", null, null, FwDirectoryFinder.LegacyWordformingCharOverridesFile);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            Assert.AreEqual(1, validCharsW.OtherCharacters.Count);
            Assert.IsTrue(validCharsW.OtherCharacters.Contains("\u2028"));
        }
        public void AddCharacter_SuperscriptedToneNumber()
        {
            ValidCharacters   validChars  = ValidCharacters.Load(string.Empty, "Test WS", null);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            validChars.AddCharacter("\u00b9");
            validChars.AddCharacter("\u2079");
            Assert.AreEqual(2, validCharsW.WordFormingCharacters.Count);
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("\u00b9"));
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("\u2079"));
            Assert.AreEqual(0, validCharsW.NumericCharacters.Count);
            Assert.AreEqual(0, validCharsW.OtherCharacters.Count);
        }
        public void AddCharacter_SuperscriptedToneNumber()
        {
            var validChars = ValidCharacters.Load(string.Empty, "Test WS", null, null, FwDirectoryFinder.LegacyWordformingCharOverridesFile);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            validChars.AddCharacter("\u00b9");
            validChars.AddCharacter("\u2079");
            Assert.AreEqual(2, validCharsW.WordFormingCharacters.Count);
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("\u00b9"));
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("\u2079"));
            Assert.AreEqual(0, validCharsW.NumericCharacters.Count);
            Assert.AreEqual(0, validCharsW.OtherCharacters.Count);
        }
Beispiel #19
0
 /// <summary>
 /// Adds the default word-forming character overrides to the list of valid
 /// characters for each vernacular writing system that is using the old
 /// valid characters representation.
 /// </summary>
 private void AddDefaultWordformingOverridesIfNeeded()
 {
     foreach (IWritingSystem wsObj in Cache.ServiceLocator.WritingSystems.VernacularWritingSystems)
     {
         string validCharsSrc = wsObj.ValidChars;
         if (!ValidCharacters.IsNewValidCharsString(validCharsSrc))
         {
             ValidCharacters valChars = ValidCharacters.Load(wsObj, LoadException);
             valChars.AddDefaultWordformingCharOverrides();
             wsObj.ValidChars = valChars.XmlString;
         }
     }
     Cache.ServiceLocator.WritingSystemManager.Save();
 }
        public void InitializeFromXml_SameCharacterInWordFormingAndNumbericXMLLists()
        {
            string sXml = ksXmlHeader + "<ValidCharacters><WordForming>1</WordForming>" +
                          "<Numeric>1</Numeric>" +
                          "<Other></Other>" +
                          "</ValidCharacters>";
            var validChars = ValidCharacters.Load(sXml, "Test WS", null, null, FwDirectoryFinder.LegacyWordformingCharOverridesFile);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            Assert.AreEqual(1, validCharsW.WordFormingCharacters.Count);
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("1"));
            Assert.AreEqual(0, validCharsW.NumericCharacters.Count);
            Assert.AreEqual(0, validCharsW.OtherCharacters.Count);
        }
        public void TestInitializeFromXml_SameCharacterInNumericAndPunctuationXMLLists()
        {
            string sXml = ksXmlHeader + "<ValidCharacters><WordForming></WordForming>" +
                          "<Numeric>1</Numeric>" +
                          "<Other>1</Other>" +
                          "</ValidCharacters>";
            ValidCharacters   validChars  = ValidCharacters.Load(sXml, "Test WS", null);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            Assert.AreEqual(0, validCharsW.WordFormingCharacters.Count);
            Assert.AreEqual(1, validCharsW.NumericCharacters.Count);
            Assert.IsTrue(validCharsW.NumericCharacters.Contains("1"));
            Assert.AreEqual(0, validCharsW.OtherCharacters.Count);
        }
Beispiel #22
0
        public void SymbolPunctuationOnly()
        {
            var validChars = ValidCharacters.Load(ksXmlHeader +
                                                  "<ValidCharacters><WordForming>a\uFFFCb\uFFFCc\uFFFCd\uFFFCe</WordForming>" +
                                                  "<Numeric>1\uFFFC2\uFFFC3\uFFFC4\uFFFC5</Numeric>" +
                                                  "<Other>'\uFFFC-\uFFFC#</Other>" +
                                                  "</ValidCharacters>", "Test WS", null, null, FwDirectoryFinder.LegacyWordformingCharOverridesFile);
            ILgCharacterPropertyEngine lgCharPropEngineEn = Cache.WritingSystemFactory.get_CharPropEngine(
                m_wsEn);

            FwCharacterCategorizer categorizer = new FwCharacterCategorizer(validChars, lgCharPropEngineEn);

            Assert.IsTrue(categorizer.IsPunctuation('#'));
            Assert.IsFalse(categorizer.IsWordFormingCharacter('#'));
        }
        public void AddCharacter_Duplicate()
        {
            ValidCharacters   validChars  = ValidCharacters.Load(string.Empty, "Test WS", null);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            validChars.AddCharacter("a");
            validChars.AddCharacter("a");
            Assert.AreEqual(1, validCharsW.WordFormingCharacters.Count);
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("a"));
            Assert.AreEqual(0, validCharsW.NumericCharacters.Count);
            Assert.AreEqual(0, validCharsW.OtherCharacters.Count);
            Assert.AreEqual(ksXmlHeader +
                            "<ValidCharacters><WordForming>a</WordForming>" +
                            "<Numeric /><Other /></ValidCharacters>",
                            validChars.XmlString.Replace(Environment.NewLine, string.Empty).Replace(">  <", "><"));
        }
        public void TestInitializeFromXml_DuplicateCharacters()
        {
            string sXml = ksXmlHeader + "<ValidCharacters><WordForming>a\uFFFCa</WordForming>" +
                          "<Numeric>4\uFFFC4</Numeric>" +
                          "<Other>'\uFFFC'</Other>" +
                          "</ValidCharacters>";
            ValidCharacters   validChars  = ValidCharacters.Load(sXml, "Test WS", null);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            Assert.AreEqual(1, validCharsW.WordFormingCharacters.Count);
            Assert.IsTrue(validCharsW.WordFormingCharacters.Contains("a"));
            Assert.AreEqual(1, validCharsW.NumericCharacters.Count);
            Assert.IsTrue(validCharsW.NumericCharacters.Contains("4"));
            Assert.AreEqual(1, validCharsW.OtherCharacters.Count);
            Assert.IsTrue(validCharsW.OtherCharacters.Contains("'"));
        }
        public void SortAfterAddSingles()
        {
            var            validChars = ValidCharacters.Load(string.Empty, "Test WS", null, null, FwDirectoryFinder.LegacyWordformingCharOverridesFile);
            IWritingSystem ws         = m_wsManager.Create("en");

            validChars.InitSortComparer(ws);
            validChars.AddCharacter("z");
            validChars.AddCharacter("c");
            validChars.AddCharacter("t");
            validChars.AddCharacter("b");
            validChars.AddCharacter("8");
            validChars.AddCharacter("7");
            validChars.AddCharacter("6");
            validChars.AddCharacter("5");
            VerifySortOrder(validChars);
        }
        public void InitializeFromXml_ValidEmpty()
        {
            string sXml = ksXmlHeader + "<ValidCharacters><WordForming />" +
                          "<Numeric />" +
                          "<Other />" +
                          "</ValidCharacters>";
            var validChars = ValidCharacters.Load(sXml, "Test WS", null, RememberError);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            Assert.AreEqual(0, validCharsW.WordFormingCharacters.Count);
            Assert.AreEqual(0, validCharsW.NumericCharacters.Count);
            Assert.AreEqual(0, validCharsW.OtherCharacters.Count);
            Assert.AreEqual(sXml,
                            validChars.XmlString.Replace(Environment.NewLine, string.Empty).Replace(">  <", "><"));
            Assert.IsNull(m_lastException);
        }
        public void SortAfterAddSingles()
        {
            var            validChars = ValidCharacters.Load(string.Empty, "Test WS", null, null);
            IWritingSystem ws         = m_wsManager.Create("en");

            validChars.InitSortComparer(ws);
            validChars.AddCharacter("z");
            validChars.AddCharacter("c");
            validChars.AddCharacter("t");
            validChars.AddCharacter("b");
            validChars.AddCharacter("8");
            validChars.AddCharacter("7");
            validChars.AddCharacter("6");
            validChars.AddCharacter("5");
            VerifySortOrder(validChars);
        }
        public void TestInitializeFromXml_ValidEmpty()
        {
            string sXml = ksXmlHeader + "<ValidCharacters><WordForming />" +
                          "<Numeric />" +
                          "<Other />" +
                          "</ValidCharacters>";
            ValidCharacters   validChars  = ValidCharacters.Load(sXml, "Test WS", null);
            ValidCharsWrapper validCharsW = new ValidCharsWrapper(validChars);

            Assert.AreEqual(0, validCharsW.WordFormingCharacters.Count);
            Assert.AreEqual(0, validCharsW.NumericCharacters.Count);
            Assert.AreEqual(0, validCharsW.OtherCharacters.Count);
            Assert.AreEqual(sXml,
                            validChars.XmlString.Replace(Environment.NewLine, string.Empty).Replace(">  <", "><"));
            Assert.IsNull(ReflectionHelper.GetField(typeof(ValidCharacters), "s_lastException"));
        }
        public void SymbolPunctuationOnly()
        {
            ValidCharacters validChars = ValidCharacters.Load(ksXmlHeader +
                                                              "<ValidCharacters><WordForming>a\uFFFCb\uFFFCc\uFFFCd\uFFFCe</WordForming>" +
                                                              "<Numeric>1\uFFFC2\uFFFC3\uFFFC4\uFFFC5</Numeric>" +
                                                              "<Other>'\uFFFC-\uFFFC#</Other>" +
                                                              "</ValidCharacters>", "Test WS", null);

            ILgCharacterPropertyEngine lgCharPropEngineEn = (ILgCharacterPropertyEngine)
                                                            m_cache.Cache.LanguageWritingSystemFactoryAccessor.get_CharPropEngine(
                InMemoryFdoCache.s_wsHvos.En);

            FwCharacterCategorizer categorizer = new FwCharacterCategorizer(validChars, lgCharPropEngineEn);

            Assert.IsTrue(categorizer.IsPunctuation('#'));
            Assert.IsFalse(categorizer.IsWordFormingCharacter('#'));
        }
        public void GetNaturalCharType()
        {
            ValidCharacters     validChars = ValidCharacters.Load(string.Empty, "Test WS", null);
            DummyCharPropEngine cpe        = new DummyCharPropEngine();

            ReflectionHelper.SetField(validChars, "m_cpe", cpe);
            Assert.AreEqual(ValidCharacterType.WordForming,
                            ReflectionHelper.GetResult(validChars, "GetNaturalCharType", (int)'a'));
            Assert.AreEqual(ValidCharacterType.WordForming,
                            ReflectionHelper.GetResult(validChars, "GetNaturalCharType", 0x00B2));
            Assert.AreEqual(ValidCharacterType.WordForming,
                            ReflectionHelper.GetResult(validChars, "GetNaturalCharType", 0x2079));
            Assert.AreEqual(ValidCharacterType.Numeric,
                            ReflectionHelper.GetResult(validChars, "GetNaturalCharType", (int)'1'));
            Assert.AreEqual(ValidCharacterType.Other,
                            ReflectionHelper.GetResult(validChars, "GetNaturalCharType", (int)' '));
        }