Exemple #1
0
    private void FillSamleText(ButtonComponent button)
    {
        WordToTranslate wordToTranslate = FindObjectOfType <WordToTranslate>();

        if (!button || !wordToTranslate)
        {
            Debug.LogWarning("Не найден WordToTranslate");
            return;
        }

        QuestionLeo quest = wordToTranslate.GetCurrentQuest();
        WordLeo     word  = null;

        foreach (var item in quest.answers)
        {
            if (button.text.text == item.translations ||
                button.text.text == item.wordValue)
            {
                word = item;
                break;
            }
        }
        if (word == null)
        {
            return;
        }
        if (button.text.text == word.translations)
        {
            SampleText.text = word.translations + " → " + word.wordValue;
        }
        else
        {
            SampleText.text = word.wordValue + " → " + word.translations;
        }
    }
        public void TranslationShouldBeSetCorrectly(string translation)
        {
            // Arrange
            var word = new WordToTranslate();

            //Act
            word.Translation = translation;

            //Assert
            Assert.AreEqual(translation, word.Translation);
        }
        public void TopicIdShouldBeSetCorrectly(int topicId)
        {
            // Arrange
            var word = new WordToTranslate();

            //Act
            word.TopicId = topicId;

            //Assert
            Assert.AreEqual(topicId, word.TopicId);
        }
        public void TextShouldBeSetCorrectly(string text)
        {
            // Arrange
            var word = new WordToTranslate();

            //Act
            word.Text = text;

            //Assert
            Assert.AreEqual(text, word.Text);
        }