public void TestXmlDictionariesServiceAddToNewFolder() { dictionaryService = new XmlDictionariesService(folder); bool result = dictionaryService.AddDictionary("test", "Lang1", "Lang2"); Assert.IsTrue(result); Assert.AreEqual(1, dictionaryService.Dictionaries.Count); }
public void TestXmlDictionariesServiceAddOk() { string dName1 = "test1"; dataLayer = new XmlDataLayer(Path.Combine(folder, dName1 + ".xml")); dataLayer.Save(dictionary); string dName2 = "test2"; dataLayer = new XmlDataLayer(Path.Combine(folder, dName2 + ".xml")); dataLayer.Save(dictionary); dictionaryService = new XmlDictionariesService(folder); Assert.AreEqual(2, dictionaryService.Dictionaries.Count); bool result = dictionaryService.AddDictionary("test", "Lang1", "Lang2"); Assert.IsTrue(result); Assert.AreEqual(3, dictionaryService.Dictionaries.Count); }
public void TestXmlDictionariesServiceAddDuplicate() { string dName1 = "test1"; dictionaryService = new XmlDictionariesService(folder); dictionaryService.AddDictionary(dName1, "Lang1", "Lang2"); bool result = dictionaryService.AddDictionary(dName1, "WrongLang1", "WrongLang2"); Assert.IsFalse(result); Assert.AreEqual(1, dictionaryService.Dictionaries.Count); // check that old dictionary was not overwritten dictionaryService = new XmlDictionariesService(folder); Assert.AreEqual("Lang1", dictionaryService.Dictionaries[0].Language1); }
public void TestXmlDictionariesServiceAddRemove() { string dName = "test"; dictionaryService = new XmlDictionariesService(folder); dictionaryService.AddDictionary(dName, "Lang1", "Lang2"); bool result = dictionaryService.RemoveDictionary(dName); Assert.IsTrue(result); Assert.AreEqual(0, dictionaryService.Dictionaries.Count); }