public void Load_Nonempty() { CoreWritingSystemDefinition ws1 = m_wsManager.Create("en"); ws1.CharacterSets.Add(new CharacterSetDefinition("main") { Characters = { "e", "f", "g", "h" } }); ws1.CharacterSets.Add(new CharacterSetDefinition("punctuation") { Characters = { ",", "!", "*" } }); ValidCharacters validChars = ValidCharacters.Load(ws1); var 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(3, validCharsW.OtherCharacters.Count); Assert.IsTrue(validCharsW.OtherCharacters.Contains(",")); Assert.IsTrue(validCharsW.OtherCharacters.Contains("!")); Assert.IsTrue(validCharsW.OtherCharacters.Contains("*")); CoreWritingSystemDefinition ws2 = m_wsManager.Create("en"); validChars.SaveTo(ws2); Assert.That(ws1.ValueEquals(ws2), Is.True); }
public void Load_Empty() { CoreWritingSystemDefinition ws1 = m_wsManager.Create("en"); ValidCharacters validChars = ValidCharacters.Load(ws1); Assert.That(validChars.WordFormingCharacters, Is.Empty); Assert.That(validChars.OtherCharacters, Is.Empty); CoreWritingSystemDefinition ws2 = m_wsManager.Create("en"); validChars.SaveTo(ws2); Assert.That(ws1.ValueEquals(ws2), Is.True); }
public void Load_Empty() { CoreWritingSystemDefinition ws1 = m_wsManager.Create("en"); ValidCharacters validChars = ValidCharacters.Load(ws1, RememberError); var validCharsW = new ValidCharsWrapper(validChars); Assert.That(validCharsW.WordFormingCharacters, Is.Empty); Assert.That(validCharsW.NumericCharacters, Is.Empty); Assert.That(validCharsW.OtherCharacters, Is.Empty); CoreWritingSystemDefinition ws2 = m_wsManager.Create("en"); validChars.SaveTo(ws2); Assert.That(ws1.ValueEquals(ws2), Is.True); Assert.That(m_lastException, Is.Null); }
public void AddCharacter_Duplicate() { CoreWritingSystemDefinition ws1 = m_wsManager.Create("en-US"); ValidCharacters validChars = ValidCharacters.Load(ws1); var 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.OtherCharacters.Count); validChars.SaveTo(ws1); CoreWritingSystemDefinition ws2 = m_wsManager.Create("en-US"); ws2.CharacterSets.Add(new CharacterSetDefinition("main") { Characters = { "a" } }); Assert.That(ws1.ValueEquals(ws2), Is.True); }