public void TestXmlDictionariesServiceInit1Dictionary()
 {
     string dName = "test";
     dataLayer = new XmlDataLayer(Path.Combine(folder, dName + ".xml"));
     dataLayer.Save(dictionary);
     dictionaryService = new XmlDictionariesService(folder);
     Assert.AreEqual(1, dictionaryService.Dictionaries.Count);
 }
예제 #2
0
 public DictionaryInfo(string name, DataLayer data)
 {
     Name = name;
     DataLayer = data;
     Dictionary = DataLayer.Read();
     Language1 = Dictionary.Language1;
     Language2 = Dictionary.Language2;
     NumOfCards = Dictionary.Count;
     TrainingAverage = new Dictionary<TrainingType, double>();
     foreach (var type in WordCard.TrainingTypes)
     {
         TrainingAverage.Add(type, (Dictionary.Average(c => c.Counter1[type]) + Dictionary.Average(c => c.Counter2[type])) / 2.0);
     }
 }
 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 TestXmlDictionariesServiceRemoveByName()
 {
     string dName = "test";
     dataLayer = new XmlDataLayer(Path.Combine(folder, dName + ".xml"));
     dataLayer.Save(dictionary);
     dictionaryService = new XmlDictionariesService(folder);
     bool result = dictionaryService.RemoveDictionary(dName);
     Assert.IsTrue(result);
     Assert.AreEqual(0, dictionaryService.Dictionaries.Count);
 }