Exemplo n.º 1
0
        static void Main(string[] args)
        {
            #region User test
            User user = new User();
            user.ReadUser("User.xml");
            Console.WriteLine(user.Name);
            foreach (TestResults tr in user.TestsPassed)
            {
                Console.WriteLine(tr.ToString());
            }
            //Console.WriteLine();
            //Console.WriteLine(user.Vocabulary.ToString());
            #endregion

            //user.Vocabulary = new Vocabulary(
            //    new Word("water"),
            //    new Word("treat"),
            //    new Word("mouse"),
            //    new Word("song"),
            //    new Word("mirror"),
            //    new Word("start"));

            //// Translate API test
            //foreach (Word w in user.Vocabulary.WordList)
            //{
            //    w.Translate();
            //}

            Console.WriteLine("--------------------------------------");
            Console.WriteLine(user.Vocabulary.ToString());

            #region Vocebulary aditional functions test
            //voc += w;
            //Console.WriteLine("--------------------------------------");
            //Console.WriteLine(voc.ToString());

            //Console.WriteLine("--------------------------------------");
            //voc -= new Word("apple", "яблоко");
            //Console.WriteLine(voc.ToString());

            //Console.WriteLine("--------------------------------------");
            //voc.WriteWords("Words.xml");
            //voc = new Vocabulary(new Word("phone", "телефон"));
            //Console.WriteLine(voc.ToString());

            //Console.WriteLine("--------------------------------------");
            //voc.ReadWords("Words.xml");
            //Console.WriteLine(voc.ToString());

            //Console.WriteLine("--------------------------------------");
            //voc.VipeTranslations();
            //Console.WriteLine(voc.ToString());

            //Console.WriteLine("--------------------------------------");
            //voc.TranslateAll();
            //Console.WriteLine(voc.ToString());

            //Text t = new Text();
            //t.TextString = Console.ReadLine();
            //foreach (string w in t.Words)
            //{
            //    Console.WriteLine(w.ToString());
            //}
            #endregion

            #region Tests test
            // Word-Translation Test=====================================
            TestWT twt = new TestWT(user.Vocabulary.WordList);

            Vocabulary testingVocebulary = new Vocabulary();
            foreach (Word w in user.Vocabulary.WordList)
            {
                testingVocebulary.Add(new Word() { Wd = w.Wd, Tr = w.Tr });
            }
            testingVocebulary.VipeTranslations();

            for (int i = 0; i < testingVocebulary.Count; i++)
            {
                Console.WriteLine("Word: " + testingVocebulary[i].Wd);
                testingVocebulary[i].Tr = Console.ReadLine();
            }

            twt.Test(testingVocebulary);
            foreach (Word w in testingVocebulary.WordList)
            {
                Console.WriteLine(w.ToString());
            }
            Console.WriteLine();

            if (twt.Results != null)
            {
                Console.WriteLine(twt.Results.ToString());
                Console.WriteLine();
                foreach (bool b in twt.CorrectionOfAnswers)
                {
                    if (b == true)
                        Console.WriteLine("Correct");
                    if (b == false)
                        Console.WriteLine("Incorrect");
                }
            }
            Console.WriteLine("-------------------------------------------");

            //// Translation-Word Test
            //TestTW ttw = new TestTW(user.Vocabulary.WordList);
            //testingVocebulary = new Vocabulary();
            //foreach (Word w in user.Vocabulary.WordList)
            //{
            //    testingVocebulary.Add(new Word() { Wd = w.Wd, Tr = w.Tr });
            //}
            //testingVocebulary.VipeWords();

            //for (int i = 0; i < testingVocebulary.Count; i++)
            //{
            //    Console.WriteLine("Translation: " + testingVocebulary[i].Tr);
            //    testingVocebulary[i].Wd = Console.ReadLine();
            //}

            //ttw.Test(testingVocebulary);
            //foreach (Word w in testingVocebulary.WordList)
            //{
            //    Console.WriteLine(w.ToString());
            //}
            //Console.WriteLine();

            //if (ttw.Results != null)
            //{
            //    Console.WriteLine(ttw.Results.ToString());
            //    Console.WriteLine();
            //    foreach (bool b in ttw.CorrectionOfAnswers)
            //    {
            //        if (b == true)
            //            Console.WriteLine("Correct");
            //        if (b == false)
            //            Console.WriteLine("Incorrect");
            //    }
            //}
            #endregion

            #region TestType Serialization test (Need to comment everything)
            //Vocabulary voc = new Vocabulary();
            //voc.ReadWords("TestWords.xml");
            //Console.WriteLine(voc.ToString());
            //voc.DeleteByPassage(TestType.WordTranslation);
            //Console.WriteLine(voc.ToString());
            //voc.WriteWords("TestWords2.xml");
            #endregion

            //user.TestsPassed.Add(twt.Results);
            //user.TestsPassed.Add(ttw.Results);
            user.WriteUser("User.xml");
        }