public static T[] MergeSort<T>(this T[] array) { AlgorithmsHelper.ThrowArgumentExceptionIfDataTypeIsClassAndNotString(typeof(T)); ProcessMergeSort(array, 0, array.Length - 1); return array; }
public void TestMethod1() { List <Person> list = new List <Person>(); list.Add(new Person { Id = 1, Name = "zzl", SortNumber = 1 }); list.Add(new Person { Id = 2, Name = "zzl2", SortNumber = 2 }); list.Add(new Person { Id = 3, Name = "zzl3", SortNumber = 3 }); list.Add(new Person { Id = 4, Name = "zzl4", SortNumber = 4 }); list.Add(new Person { Id = 5, Name = "zzl5", SortNumber = 5 }); list.Add(new Person { Id = 6, Name = "zzl6", SortNumber = 6 }); list.Add(new Person { Id = 7, Name = "zzl7", SortNumber = 7 }); list.Add(new Person { Id = 8, Name = "zzl8", SortNumber = 8 }); list.Add(new Person { Id = 9, Name = "zzl9", SortNumber = 9 }); Console.WriteLine("Hello World!"); AlgorithmsHelper.Sortable_Up_Down(list, 1, 7); }
public void Get_The_Same_Length_Numbers(string firstNumber, string secondNumber, string firstExpectedResult, string secondExpectedResult) { var(numberOne, numberTwo) = AlgorithmsHelper.GetTheSameLengthNumbers(firstNumber, secondNumber); Assert.Equal(firstExpectedResult, numberOne); Assert.Equal(secondExpectedResult, numberTwo); }
public void NonNumber_Characters_Throws_Exception() { Action invalidExecution = () => AlgorithmsHelper.EnsureNumber("1s"); Assert.Throws <ArgumentException>(invalidExecution); }
public void Get_Even_Digits_Numbers(string number, string expectedResult) { var result = AlgorithmsHelper.GetEvenDigitsNumber(number); Assert.Equal(expectedResult, result); }