コード例 #1
0
 public void TestSaveReadWComments()
 {
     XmlDataLayer doc = new XmlDataLayer(pathToXml);
     doc.Save(dictionary);
     var dictionaryRead = doc.Read();
     ValidatingDictionaries(dictionary, dictionaryRead);
 }
コード例 #2
0
        public void TestSaveReadCountersIncreased()
        {
            for (int i = maxCards / 2; i < maxCards - 1; i++)
            {
                dictionary.Add(generator.GetCardExtra(5));
            }

            XmlDataLayer doc = new XmlDataLayer(pathToXml);
            doc.Save(dictionary);
            var dictionaryRead = doc.Read();
            ValidatingDictionaries(dictionary, dictionaryRead);
        }
コード例 #3
0
        public void TestSaveReadWOComments()
        {
            WordCard card = dictionary[0];
            card.CommentCommon = "";
            card = dictionary[1];
            card.Comment1 = null;

            XmlDataLayer doc = new XmlDataLayer(pathToXml);
            doc.Save(dictionary);
            var dictionaryRead = doc.Read();
            ValidatingDictionaries(dictionary, dictionaryRead);
        }
コード例 #4
0
        public void TestSaveReadTwice()
        {
            XmlDataLayer doc = new XmlDataLayer(pathToXml);
            doc.Save(dictionary);
            var dictionaryRead = doc.Read();
            ValidatingDictionaries(dictionary, dictionaryRead);

            dictionary = dictionaryRead;
            dictionary[0].Word1 = "qwer";
            dictionary[1].CommentCommon = "asdf";
            doc.Save(dictionary);
            dictionaryRead = doc.Read();
            ValidatingDictionaries(dictionary, dictionaryRead);
        }
コード例 #5
0
        public override bool AddDictionary(string name, string lang1, string lang2)
        {
            DictionaryInfo check = GetDictionary(name);
            if (check != null)
                return false;

            WordsDictionary dictionary = new WordsDictionary(lang1, lang2);
            dictionary.Add(new WordCard("Hello", "Hello", WordType.Noun)); // HACK:
            DataLayer data = new XmlDataLayer(GetFullPath(name));
            data.Save(dictionary);

            DictionaryInfo dictionaryInfo = new DictionaryInfo(name, data);
            Dictionaries.Add(dictionaryInfo);

            return true;
        }
コード例 #6
0
 public void TestSwitchBeforeSave()
 {
     XmlDataLayer doc = new XmlDataLayer(pathToXml);
     dictionary[0].Switched = true;
     doc.Save(dictionary);
     Assert.IsFalse(dictionary[0].Switched, "Validating that Card was switched back befor saving");
     var dictionaryRead = doc.Read();
     ValidatingDictionaries(dictionary, dictionaryRead);
 }