Exemplo n.º 1
0
        public void PrepareWords_ShouldReturnAllWords_OnAllSelected()
        {
            wordSelector.IsSelectedWord(Arg.Any <Word>()).ReturnsForAnyArgs(x => ((Word)x[0]).Value == "word");
            var words = new List <string> {
                "word", "word", "word"
            };
            var processor = new WordProcessor(wordSelector, wordCounter);

            var result = processor.PrepareWords(words);

            result.Select(w => w.Value).Should().BeEquivalentTo(words);
        }
Exemplo n.º 2
0
 public void SetUp()
 {
     wordCounter = Substitute.For <IWordCounter>();
     wordCounter.GetCountedWords(Arg.Any <IEnumerable <Word> >()).Returns(w => w[0]);
     wordSelector = Substitute.For <IWordSelector>();
     wordSelector.IsSelectedWord(null).ReturnsForAnyArgs(true);
 }
Exemplo n.º 3
0
        public IEnumerable<Word> PrepareWords(IEnumerable<string> rawWords)
        {
            var convertedWords = rawWords
                .Select(rawWord => rawWord.ToLower())
                .Select(word => new Word(word));
            var countedWords = wordCounter.GetCountedWords(convertedWords);
            return countedWords
                .Where(word => wordSelector.IsSelectedWord(word));

        }