public void PartialMergeSort_Comparison(int[] input, int index, int count, int[] expected) { var actual = SortExtensions.MergeSort(input, index, count, IntComparison); Assert.Equal(expected, actual); Assert.Same(input, actual); }
public void MergeSort_Comparison_Preconditions() { Assert.Throws <ArgumentNullException>( () => SortExtensions.MergeSort(null, IntComparison)); Assert.Throws <ArgumentNullException>( () => SortExtensions.MergeSort(new[] { 1 }, (Comparison <int>)null)); }
public void StableSort_Comparer(int[] input, int[] expected) { var actual = SortExtensions.StableSort(input, IntComparer); Assert.Equal(expected, actual); Assert.Same(input, actual); }
public void MergeSort_Comparison(int[] input, int[] expected) { var actual = SortExtensions.MergeSort(input, (l, r) => r.CompareTo(l)); Assert.Equal(expected, actual); Assert.Same(input, actual); }
public void MergeSort(int[] input, int[] expected) { var actual = SortExtensions.MergeSort(input); Assert.Equal(expected, actual); Assert.Same(input, actual); }
public static int CompareByField(DepTaxParcel e1, DepTaxParcel e2, string sortBy) { int result = 0; switch (sortBy) { case "PrintKey": result = SortExtensions.Compare(e1.PrintKey, e2.PrintKey); break; case "SBL": result = SortExtensions.Compare(e1.SBL, e2.SBL); break; case "SWIS": result = SortExtensions.Compare(e1.SWIS, e2.SWIS); break; case "County": result = SortExtensions.Compare(e1.County, e2.County); break; default: break; } return(result); }
public void PartialStableSort(int[] input, int index, int count, int[] expected) { var actual = SortExtensions.StableSort(input, index, count); Assert.Equal(expected, actual); Assert.Same(input, actual); }
public void StableSort_Comparer_Preconditions() { Assert.Throws <ArgumentNullException>( () => SortExtensions.StableSort(null, IntComparer)); Assert.Throws <ArgumentNullException>( () => SortExtensions.StableSort(new[] { 1 }, (IComparer <int>)null)); }
public void TryGetPagingResult() { var result = db .Users .GetPagingResult(1, 0, 100, SortExtensions.Create("Id")); Assert.IsNotNull(result); Assert.IsTrue(result.Success == true); Assert.IsTrue(result.Total == 1002); Assert.IsTrue(result.Items.Count() == 100); }
public void PartialMergeSort_Preconditions() { Assert.Throws <ArgumentNullException>( () => SortExtensions.MergeSort((IList <int>)null, 0, 0)); Assert.Throws <ArgumentOutOfRangeException>( () => SortExtensions.MergeSort(new[] { 1, 2 }, -1, 1)); Assert.Throws <ArgumentOutOfRangeException>( () => SortExtensions.MergeSort(new[] { 1, 2 }, 0, -1)); Assert.Throws <ArgumentException>( () => SortExtensions.MergeSort(new[] { 1, 2 }, 2, 1)); Assert.Throws <ArgumentException>( () => SortExtensions.MergeSort(new[] { 1, 2 }, 0, 3)); }
public void PartialMergeSort_Comparison_Preconditions() { Assert.Throws <ArgumentNullException>( () => SortExtensions.MergeSort(null, 0, 0, IntComparison)); Assert.Throws <ArgumentNullException>( () => SortExtensions.MergeSort(new[] { 1, 2 }, 0, 1, (Comparison <int>)null)); Assert.Throws <ArgumentOutOfRangeException>( () => SortExtensions.MergeSort(new[] { 1, 2 }, -1, 1, IntComparison)); Assert.Throws <ArgumentOutOfRangeException>( () => SortExtensions.MergeSort(new[] { 1, 2 }, 0, -1, IntComparison)); Assert.Throws <ArgumentException>( () => SortExtensions.MergeSort(new[] { 1, 2 }, 2, 1, IntComparison)); Assert.Throws <ArgumentException>( () => SortExtensions.MergeSort(new[] { 1, 2 }, 0, 3, IntComparison)); }
public static int CompareByField(TaxParcelOwner e1, TaxParcelOwner e2, string sortBy) { int result = 0; switch (sortBy) { case "active": result = SortExtensions.Compare(e1.active, e2.active); break; default: break; } return(result); }
public void PartialStableSort_Comparer_Preconditions() { Assert.Throws <ArgumentNullException>( () => SortExtensions.StableSort(null, 0, 0, IntComparer)); Assert.Throws <ArgumentNullException>( () => SortExtensions.StableSort(new[] { 1, 2 }, 0, 0, (IComparer <int>)null)); Assert.Throws <ArgumentOutOfRangeException>( () => SortExtensions.StableSort(new[] { 1, 2 }, -1, 1, IntComparer)); Assert.Throws <ArgumentOutOfRangeException>( () => SortExtensions.StableSort(new[] { 1, 2 }, 0, -1, IntComparer)); Assert.Throws <ArgumentException>( () => SortExtensions.StableSort(new[] { 1, 2 }, 2, 1, IntComparer)); Assert.Throws <ArgumentException>( () => SortExtensions.StableSort(new[] { 1, 2 }, 0, 3, IntComparer)); }
public void StableSortBy() { var input = new List <X> { new X(0, "30"), new X(1, "20"), new X(2, null), new X(3, "10"), }; var actual = SortExtensions.StableSortBy(input, x => x.B); Assert.Equal(2, input[0].A); Assert.Equal(3, input[1].A); Assert.Equal(1, input[2].A); Assert.Equal(0, input[3].A); Assert.Same(input, actual); }
public static int CompareByField(TaxParcel e1, TaxParcel e2, string sortBy) { int result = 0; switch (sortBy) { case "taxParcelID": result = SortExtensions.Compare(e1.taxParcelID, e2.taxParcelID); break; case "SBL": result = SortExtensions.Compare(e1.SBL, e2.SBL); break; case "Swis": result = SortExtensions.Compare(e1.Swis.pk_list_swis, e2.Swis.pk_list_swis); break; case "County": result = SortExtensions.Compare(e1.Swis.county, e2.Swis.county); break; case "Jurisdiction": result = SortExtensions.Compare(e1.Swis.jurisdiction, e2.Swis.jurisdiction); break; case "ownerStr_dnd": result = SortExtensions.Compare(e1.ownerStr_dnd, e2.ownerStr_dnd); break; case "retired": result = SortExtensions.Compare(e1.retired, e2.retired); break; default: break; } return(result); }
public static int CompareByField(TaxParcelOwnerView e1, TaxParcelOwnerView e2, string sortBy) { int result = 0; switch (sortBy) { case "taxParcelID": result = SortExtensions.Compare(e1.taxParcelID, e2.taxParcelID); break; case "SBL": result = SortExtensions.Compare(e1.SBL, e2.SBL); break; case "fullname_LF_dnd": result = SortExtensions.Compare(e1.fullname_LF_dnd, e2.fullname_LF_dnd); break; default: break; } return(result); }
public void StableSort_Preconditions() { Assert.Throws <ArgumentNullException>( () => SortExtensions.StableSort((IList <int>)null)); }