Exemple #1
0
        public void TestTextIsSplittedToWordsInParallelWithOneDictionary()
        {
            IDataWriter dataWriter = new TestDataWriter();

            FrequencyCalculationService.NewFrequencyCalculationService calculationService =
                new NewFrequencyCalculationService(
                    new StreamBlockReader(MinBlockSize, MinBlockSize + MaxWordLength, delimiters, inputStream),
                    dataWriter,
                    new FrequencyCalculatorWithUpdater(MaxWordLength));
            calculationService.RunCalculationAsync().Wait();

            Assert.AreEqual(80979, ((TestDataWriter)dataWriter).Data.Count);
        }
Exemple #2
0
        public void TestTextIsSplittedToWordsInSingleThread()
        {
            IDataWriter dataWriter = new TestDataWriter();
            SingleThreadedFrequencyCalculationService calculationService =
                new SingleThreadedFrequencyCalculationService(
                    new StreamBlockReader(MinBlockSize, MinBlockSize + MaxWordLength, delimiters, inputStream),
                    dataWriter,
                    new DataAggregator(),
                    new FrequencyCalculator(MaxWordLength));

            calculationService.RunCalculation();

            Assert.AreEqual(80979, ((TestDataWriter)dataWriter).Data.Count);
        }