예제 #1
0
 /// <summary>
 /// Insert the items in the input into the sorter in a mixed-up order.
 /// </summary>
 /// <param name="sorter"></param>
 /// <param name="input"></param>
 private void ShuffleInputs(BigDataSorter sorter, SortedDictionary <string, byte[]> input)
 {
     // Insert all the even items in oder.
     for (int i = 0; i < input.Count / 2; i++)
     {
         sorter.Add(input.ElementAt(i * 2).Key, input.ElementAt(i * 2).Value);
     }
     // And all the odd items in reverse order.
     for (int i = input.Count - 1; i > 0; i--)
     {
         if (i % 2 == 1)
         {
             sorter.Add(input.ElementAt(i).Key, input.ElementAt(i).Value);
         }
     }
 }
예제 #2
0
        public void OneItem()
        {
            var output = new List <byte[]>();
            var sorter = new BigDataSorter();

            sorter.Add("a", new byte[] { 1 });
            sorter.WriteResults(val => output.Add(val));
            Assert.That(output, Has.Count.EqualTo(1));
            VerifyByteArray(output[0], new byte[] { 1 });
        }