public void CreatNewUser()
        {
            var user = EnglishCouch.AddNewUser("Tom", FilePath);

            Assert.AreEqual(user.Name, "Tom");
            Assert.AreEqual(user.PathToTheFile, FilePath + "Tom.json");
        }
        public void LogInUser()
        {
            var user = EnglishCouch.AddNewUser("Ban", FilePath);

            user = EnglishCouch.LogInUser("Ban", FilePath);

            Assert.AreEqual(user.Name, "Ban");
            Assert.AreEqual(user.PathToTheFile, FilePath + "Ban.json");
        }
        public void CheckTrueTheAnswer_and_CheckFalseTheAnswer_ShouldNotBeEqual()
        {
            var user = EnglishCouch.AddNewUser("Ken", FilePath);

            user = EnglishCouch.LogInUser("Ken", FilePath);
            var word   = EnglishCouch.GetAWordForTraining(user);
            var valueF = EnglishCouch.CheckFalseTheAnswer(word, user);
            var valueT = EnglishCouch.CheckTrueTheAnswer(word, user);

            Assert.AreNotEqual(valueF, valueT);
        }
Exemple #4
0
 private void LogIn_Click(object sender, EventArgs e)
 {
     try
     {
         user = EnglishCouch.LogInUser(UserData.Text, Path);
     }
     catch
     {
         MessageBox.Show("Пользователя с таким именем нет");
     }
     UserData.Text.DefaultIfEmpty();
 }
Exemple #5
0
        private void ShowAllWords_Click(object sender, EventArgs e)
        {
            this.listView1.Items.Clear();
            List <TheWord> list = new List <TheWord>(EnglishCouch.ShowAllWords(user));

            this.listView1.FullRowSelect = true;
            this.listView1.GridLines     = true;
            foreach (TheWord w in list)
            {
                System.Windows.Forms.ListViewItem item = new ListViewItem(new string[] { w.Russian, w.English, w.NumberOfCorrectAnswers.ToString() }, 0);
                this.listView1.Items.Add(item);
            }
            this.listView1.View = System.Windows.Forms.View.Details;
        }
Exemple #6
0
 private void GetWord_Click(object sender, EventArgs e)
 {
     CurrentWord = EnglishCouch.GetAWordForTraining(user);
     if (CurrentWord != null)
     {
         EnglishWord.Text = CurrentWord.English;
         RussianWord.Text = CurrentWord.Russian;
     }
     else
     {
         MessageBox.Show("Все слова выучены");
         Application.Exit();
     }
 }
        public void WordCanNotBeGivenMoreThenThreeTimes()
        {
            User user = EnglishCouch.AddNewUser("Mark", FilePath);
            var  word = new TheWord("мама", "mom");

            var valueT1 = EnglishCouch.CheckTrueTheAnswer(word, user);

            var valueT2 = EnglishCouch.CheckTrueTheAnswer(word, user);

            var valueT3 = EnglishCouch.CheckTrueTheAnswer(word, user);

            var valueT4 = EnglishCouch.CheckTrueTheAnswer(word, user);

            Assert.IsFalse(valueT4);
        }
        public void EctualArray_and_ExpectedArray_ShouldBeEqual()
        {
            User           user        = EnglishCouch.AddNewUser("Lee", FilePath);
            List <TheWord> EctualArray = new List <TheWord>();

            EctualArray.Add(new TheWord("мама", "mom"));
            EctualArray.Add(new TheWord("папа", "dad"));
            IEnumerable <TheWord> Dictionary = EnglishCouch.ShowAllWords(user);
            var ExpectedArray = new List <TheWord>(Dictionary);

            Assert.AreEqual(EctualArray[0].English, ExpectedArray[0].English);
            Assert.AreEqual(EctualArray[0].Russian, ExpectedArray[0].Russian);
            Assert.AreEqual(EctualArray[0].NumberOfCorrectAnswers, ExpectedArray[0].NumberOfCorrectAnswers);
            Assert.AreEqual(EctualArray[1].English, ExpectedArray[1].English);
            Assert.AreEqual(EctualArray[1].Russian, ExpectedArray[1].Russian);
            Assert.AreEqual(EctualArray[1].NumberOfCorrectAnswers, ExpectedArray[1].NumberOfCorrectAnswers);
        }
        public void Mathod_GetAWordForTraining_ShouldNotGivLearnedWord()
        {
            User user = EnglishCouch.AddNewUser("Stefun", FilePath);

            var word   = new TheWord("мама", "mom");
            var valueT = EnglishCouch.CheckTrueTheAnswer(word, user);

            valueT = EnglishCouch.CheckTrueTheAnswer(word, user);
            valueT = EnglishCouch.CheckTrueTheAnswer(word, user);

            word   = new TheWord("папа", "dad");
            valueT = EnglishCouch.CheckTrueTheAnswer(word, user);
            valueT = EnglishCouch.CheckTrueTheAnswer(word, user);
            valueT = EnglishCouch.CheckTrueTheAnswer(word, user);

            word = EnglishCouch.GetAWordForTraining(user);
            Assert.IsNull(word);
        }
        public void ShowAllLearnedWords()
        {
            User user = EnglishCouch.AddNewUser("Stefun", FilePath);
            var  word = new TheWord("мама", "mom");

            var valueT1 = EnglishCouch.CheckTrueTheAnswer(word, user);

            var valueT2 = EnglishCouch.CheckTrueTheAnswer(word, user);

            var valueT3 = EnglishCouch.CheckTrueTheAnswer(word, user);

            var     List = new List <TheWord>(EnglishCouch.ShowShowLearnedWords(user));
            TheWord Word = new TheWord("мама", "mom");

            word.NumberOfCorrectAnswers = 3;
            Assert.AreEqual(List[0].English, word.English);
            Assert.AreEqual(List[0].Russian, word.Russian);
            Assert.AreEqual(List[0].NumberOfCorrectAnswers, word.NumberOfCorrectAnswers);
        }
Exemple #11
0
 private void False_Click(object sender, EventArgs e)
 {
     CurrenAnswer = EnglishCouch.CheckFalseTheAnswer(CurrentWord, user);
     Answer.Text  = CurrenAnswer.ToString();
 }
Exemple #12
0
 private void Register_Click(object sender, EventArgs e)
 {
     user = EnglishCouch.AddNewUser(UserData.Text, Path);
     UserData.Text.DefaultIfEmpty();
 }