public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
                                        JsonSerializer serializer)
        {
            var stringSort = reader.Value as string;

            return(SortingExtensions.ToSortDirection(stringSort));
        }
Ejemplo n.º 2
0
 public MyDateTime[] SortDateTimes_FewLambdas_Slinq()
 {
     return
         (SortingExtensions.OrderBy(GenerateRandomDates(), date => date.Year)
          .ThenBy(date => date.Month)
          .ThenBy(date => date.Day)
          .ToArray());
 }
Ejemplo n.º 3
0
        public void AllSortingRulesShouldBeRespected()
        {
            var randomDates  = GenerateRandomDates();
            var sortedByLinq = Enumerable.OrderBy(randomDates, date => date.Year).ThenBy(date => date.Month).ThenBy(date => date.Day).ToArray();

            var result = SortingExtensions.OrderBy(randomDates, date => date.Year).ThenBy(date => date.Month).ThenBy(date => date.Day).ToArray();

            CollectionAssert.AreEqual(sortedByLinq, result);
        }
Ejemplo n.º 4
0
        public void SingleSortingRulesShouldBeRespected()
        {
            var randomNumbers = GenerateRandomNumbers();
            var sortedByLinq  = Enumerable.OrderBy(randomNumbers, number => number).ToArray();

            var result = SortingExtensions.OrderBy(randomNumbers, number => number).ToArray();

            CollectionAssert.AreEqual(sortedByLinq, result);
        }
Ejemplo n.º 5
0
 public DateTime[] SortDatetimes_Random_Slinq()
 {
     return(SortingExtensions.OrderBy(DataGenerator.GenerateRandomDates(1000), date => date.Year).ThenBy(date => date.Month).ThenBy(date => date.Day).ToArray());
 }
Ejemplo n.º 6
0
 public int[] SortSimpleIntegers_Random_Slinq()
 {
     return(SortingExtensions.OrderBy(DataGenerator.GenerateRandomNumbers(1000), number => number).ToArray());
 }
Ejemplo n.º 7
0
 public int[] SortSimpleIntegers_Reversed_Slinq()
 {
     return(SortingExtensions.OrderBy(Enumerable.Range(1, 1000).Reverse().ToArray(), number => number).ToArray());
 }
Ejemplo n.º 8
0
 public int[] SlinqExtensions()
 {
     return(SortingExtensions.OrderBy(DataGenerator.GenerateRandomNumbers(), number => number).ToArray());
 }
 public DateTime[] SortDateTimes_SingleComparerThatUsesFewFields_Slinq()
 {
     return(SortingExtensions.Sort(DataGenerator.GenerateRandomDates(), new DateTimeComparer()));
 }