public void WordsStartingWithAdjacentCodepointsGoToDifferentPartitions() { var sut = new ByFirstCharPartitioner(); var partitionQueues = new BlockingCollection <string> [2]; partitionQueues[0] = new BlockingCollection <string>(); partitionQueues[1] = new BlockingCollection <string>(); var testWords = GenerateWordsStartingWith('a').Concat(GenerateWordsStartingWith('b')).ToArray(); sut.PartitionIntoQueues(testWords, partitionQueues); Assert.IsTrue( partitionQueues[0].Count == testWords.Length / 2 && partitionQueues[1].Count == testWords.Length / 2); }
public void WordsStartingWithSameLetterGoToSamePartition() { var sut = new ByFirstCharPartitioner(); var partitionQueues = new BlockingCollection <string> [2]; partitionQueues[0] = new BlockingCollection <string>(); partitionQueues[1] = new BlockingCollection <string>(); var testWords = GenerateWordsStartingWith('a').ToArray(); sut.PartitionIntoQueues(testWords, partitionQueues); Assert.IsTrue( partitionQueues[0].Count == testWords.Length && partitionQueues[1].Count == 0 || partitionQueues[0].Count == 0 && partitionQueues[1].Count == testWords.Length); }