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); }
public Form1() { InitializeComponent(); wordSelector = new WordSelector(); newGame(); }
/// <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); }
public ByLineWordReader(string filePath, IWordSelector selector) { this.filePath = filePath; this.selector = selector; }
public WordProcessor(IWordSelector wordSelector, IWordCounter wordCounter) { this.wordSelector = wordSelector; this.wordCounter = wordCounter; }