Example #1
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);
 }
Example #2
0
        public Form1()
        {
            InitializeComponent();
            wordSelector = new WordSelector();

            newGame();
        }
Example #3
0
    /// <summary>
    /// Given a specific selector, select a word from the word bank to use.  Returns
    /// a WordTransaction that can be used to notify changes to the word that should
    /// be reflected in the bank.
    ///
    /// Once a transaction has begun, you cannot start any new transactions until you
    /// call EndWord.  Modifications to the word will not take effect unless EndWord
    /// is called.
    /// </summary>
    public WordTransaction BeginWord(IWordSelector selector)
    {
        if (_currentTransaction != null)
        {
            throw new InvalidOperationException("Cannot begin a new word transaction while one is currently in progress.");
        }

        string word = selector.SelectWord(_wordData.ToArray(), _entryHistory.ToArray());

        _currentTransaction = new WordTransaction(word, endWord);
        return(_currentTransaction);
    }
Example #4
0
 public ByLineWordReader(string filePath, IWordSelector selector)
 {
     this.filePath = filePath;
     this.selector = selector;
 }
Example #5
0
 public WordProcessor(IWordSelector wordSelector, IWordCounter wordCounter)
 {
     this.wordSelector = wordSelector;
     this.wordCounter = wordCounter;
 }