コード例 #1
0
        public void GetSentence_ReturnsSentence_String()
        {
            string     sentence   = "Hello World";
            ChangeWord newRequest = new ChangeWord("Hello World", "world", "universe");
            string     result     = newRequest.Sentence;

            Assert.AreEqual(sentence, result);
        }
コード例 #2
0
 public TrainingWords(String Path, MainForm.StartLoad del1, MainForm.StopLoad del2, ChangeWord ch)
 {
     StartLoad   += del1;
     StopLoad    += del2;
     ChangedWord += ch;
     Initialize();
     SetPath(Path);
 }
コード例 #3
0
        public void ReturnSentece_ContainsWord_String()
        {
            //Arrange
            string     sentence   = "Hello World";
            string     firstWord  = "world";
            string     secondWord = "universe";
            ChangeWord newRequest = new ChangeWord(sentence, firstWord, secondWord);
            //Act
            string result = newRequest.ReturnSentence(sentence, firstWord, secondWord);

            //Check
            Assert.AreEqual("true", result);
        }
コード例 #4
0
        public void SetSentence_ReturnsSentence_String()
        {
            //Arrange
            ChangeWord newRequest      = new ChangeWord("Hello World", "world", "universe");
            string     updatedSentence = "Goodbye World";

            //Act
            newRequest.Sentence = updatedSentence;
            string result = newRequest.Sentence;

            //Check
            Assert.AreEqual(updatedSentence, result);
        }
コード例 #5
0
ファイル: SpellCheck.cs プロジェクト: tjeenal95/subtitleedit
        public void DoAction(SpellCheckAction action)
        {
            switch (action)
            {
            case SpellCheckAction.Change:
                _noOfChangedWords++;
                _mainWindow.CorrectWord(_prefix + ChangeWord + _postfix, _currentParagraph, _prefix + _currentWord + _postfix, ref _firstChange, _wordsIndex);
                break;

            case SpellCheckAction.ChangeAll:
                _noOfChangedWords++;
                if (!_changeAllDictionary.ContainsKey(_currentWord))
                {
                    _changeAllDictionary.Add(_currentWord, ChangeWord);
                }
                _mainWindow.CorrectWord(_prefix + ChangeWord + _postfix, _currentParagraph, _prefix + _currentWord + _postfix, ref _firstChange, -1);
                break;

            case SpellCheckAction.Skip:
                _noOfSkippedWords++;
                break;

            case SpellCheckAction.SkipAll:
                _noOfSkippedWords++;
                _skipAllList.Add(ChangeWord.ToUpper());
                if (ChangeWord.EndsWith('\'') || ChangeWord.StartsWith('\''))
                {
                    _skipAllList.Add(ChangeWord.ToUpper().Trim('\''));
                }
                break;

            case SpellCheckAction.AddToDictionary:
                if (_spellCheckWordLists.AddUserWord(ChangeWord))
                {
                    _noOfAddedWords++;
                }
                break;

            case SpellCheckAction.AddToNamesEtc:
                _spellCheckWordLists.AddName(ChangeWord);
                if (string.Compare(ChangeWord, _currentWord, StringComparison.OrdinalIgnoreCase) != 0)
                {
                    return;     // don't prepare next word if change was more than just casing
                }
                if (ChangeWord != _currentWord)
                {
                    _changeAllDictionary.Add(_currentWord, ChangeWord);
                    _mainWindow.CorrectWord(_prefix + ChangeWord + _postfix, _currentParagraph, _prefix + _currentWord + _postfix, ref _firstChange, -1);
                }
                break;

            case SpellCheckAction.ChangeWholeText:
                _mainWindow.ShowStatus(string.Format(Configuration.Settings.Language.Main.SpellCheckChangedXToY, _currentParagraph.Text.Replace(Environment.NewLine, " "), ChangeWholeText.Replace(Environment.NewLine, " ")));
                _currentParagraph.Text = ChangeWholeText;
                _mainWindow.ChangeWholeTextMainPart(ref _noOfChangedWords, ref _firstChange, _currentIndex, _currentParagraph);

                break;
            }
            labelActionInfo.Text = string.Empty;
            PrepareNextWord();
            CheckActions();
        }
コード例 #6
0
        public void ChangeWordConstructor_CreatesInstanceOfChangeWord_ChangeWord()
        {
            ChangeWord newRequest = new ChangeWord("Hello World", "world", "universe");

            Assert.AreEqual(typeof(ChangeWord), newRequest.GetType());
        }