Ejemplo n.º 1
0
        public void ShouldThrow_WhenInputFileNotFound()
        {
            // arrange
            var chunkReader    = new SimpleChunkFileReader();
            var chunkProcessor = new ChunkProcessor();
            var chunkMerger    = new ChunkResultMerger();
            var wordCounter    = new ChunkWordFrequencyCounter(chunkReader, chunkProcessor, chunkMerger);

            // act & assert
            Assert.Throws <FileNotFoundException>(() => wordCounter.Process("not.existed"));
        }
Ejemplo n.º 2
0
        public void ShouldProcessFile(string inputFile, string expectedData)
        {
            // arrange
            var expected       = expectedData.ToDictionary();
            var chunkReader    = new SimpleChunkFileReader();
            var chunkProcessor = new ChunkProcessor();
            var chunkMerger    = new ChunkResultMerger();
            var wordCounter    = new ChunkWordFrequencyCounter(chunkReader, chunkProcessor, chunkMerger);

            // act
            var actual = wordCounter.Process(inputFile);

            // assert
            Assert.Equal(expected, actual);
        }