public void ShouldThrow_WhenChunkResultsAreNull() { // arrange var chunkResultMerger = new ChunkResultMerger(); // act & assert Assert.Throws <ArgumentNullException>(() => chunkResultMerger.Merge(chunkResults: null)); }
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")); }
public void ShouldMerge(string input, string strExpected) { // arrange var chunkResults = input.ToChunkResultArray(); var expected = strExpected.ToDictionary(); var chunkResultMerger = new ChunkResultMerger(); // act var actual = chunkResultMerger.Merge(chunkResults); // assert Assert.Equal(expected, actual); }
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); }