public void BufferedChunkWordFrequencyCounterTest()
        {
            var wordCounter = new ChunkWordFrequencyCounter(
                new BufferedChunkFileReader(),
                new ChunkProcessor(),
                new ChunkResultMerger());

            wordCounter.Process(InputFilePath);
        }
Exemple #2
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"));
        }
Exemple #3
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);
        }