Esempio n. 1
0
        public void RunWithoutFinish_WithEmptyInput()
        {
            var r = new MockReader(new string[] { });
            var p = new MockProcessor();

            var alg = new WordProcessingAlgorithm(r, p);

            alg.RunWithoutFinish();

            CollectionAssert.AreEqual(new List <string>(), p.words);
            Assert.AreEqual(0, p.FinishCalled);
            Assert.AreEqual(0, p.WordsProcessed);
        }
Esempio n. 2
0
        public void Run_WithNonEmptyInput()
        {
            string[] words = new string[] { "No,", "I", "am", "your", "father.", "Nooooo!" };
            var      r     = new MockReader(words);
            var      p     = new MockProcessor();

            var alg = new WordProcessingAlgorithm(r, p);

            alg.Run();

            CollectionAssert.AreEqual(words, p.words);
            Assert.AreEqual(words.Length, p.WordsProcessed);
            Assert.AreEqual(1, p.FinishCalled);
        }