Beispiel #1
0
        public void AddCharacter_DuplicateOfOverriddenWordFormingChar()
        {
            CoreWritingSystemDefinition ws = m_wsManager.Create("en-US");

            ws.CharacterSets.Add(new CharacterSetDefinition("main")
            {
                Characters = { "a", "-" }
            });
            ws.CharacterSets.Add(new CharacterSetDefinition("punctuation")
            {
                Characters = { "{" }
            });
            ValidCharacters validChars  = ValidCharacters.Load(ws);
            var             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 IsWordFormingChar()
        {
            CoreWritingSystemDefinition ws = m_wsManager.Create("en-US");

            ws.CharacterSets.Add(new CharacterSetDefinition("main")
            {
                Characters = { "a", "b", "c", "d", "e", "#" }
            });
            ValidCharacters validChars = ValidCharacters.Load(ws);

            Assert.IsTrue(validChars.IsWordForming('#'));
        }