public static int[] GenerateRandomNumbers(int count = 300) { var random = new Random(InitialRandomSeed); return(StrongEnumerable.Range(1, count) .Select(_ => random.Next()).ToArray()); }
public void ToArrayShouldReturnTheSameResultAsMsLinqToArray() { var expectedResult = Enumerable.Range(100, 200).Select(number => number - 50).ToArray(); var result = StrongEnumerable.Range(100, 200).Select(number => number - 50).ToArray(); CollectionAssert.AreEqual(expectedResult, result); }
public static HugeValueType[] GenerateHugeValueTypes(int count = 300) { var random = new Random(InitialRandomSeed); return(StrongEnumerable.Range(1, count) .Select(_ => new HugeValueType(random.Next(), random.Next(), random.Next(), random.Next())) .ToArray()); }
public void CreateFromArrayShouldNotAllocateAnyMemory() { var array = StrongEnumerable.Range(0, 10).Select(_ => _).ToArray(); var list = ListFactory <int> .Create(array); var extractedArray = ArrayProvider <int> .GetWrappedArray(list); Assert.AreSame(array, extractedArray); CollectionAssert.AreEqual(array, list); }
public static DateTime[] GenerateRandomDates(int count = 300) { var random = new Random(InitialRandomSeed); return(StrongEnumerable.Range(1, count) .Select(_ => new DateTime( random.Next(2000, 2015), random.Next(1, 12), random.Next(1, 28))) .ToArray()); }
public int[] SortSimpleIntegers_Ordered_Linq() { return(Enumerable.OrderBy(StrongEnumerable.Range(1, 1000).ToArray(), number => number).ToArray()); }
private static IntWrapper[] GenerateRandomWrappedNumbers() { var random = new Random(1834607); // same seed for all ensures that the values are going to be the same return(StrongEnumerable.Range(1, 300).Select(_ => new IntWrapper(random.Next())).ToArray()); }
public List <int> ToList_Slinq() { return(StrongEnumerable.Range(100, 200).Select(number => number - 50).ToList()); }
public int[] ToArray_Slinq() { return(StrongEnumerable.Range(100, 200).Select(number => number - 50).ToArray()); }