public void MergeByOrderedByLastItemIsLargest() { const int expectedLast = 43; var a = new MergeByTestItem[] { new MergeByTestItem { Id = 1 }, new MergeByTestItem { Id = 8 }, new MergeByTestItem { Id = 13 }, new MergeByTestItem { Id = 19 }, new MergeByTestItem { Id = 40 }, }; var b = new MergeByTestItem[] { new MergeByTestItem { Id = 0 }, new MergeByTestItem { Id = 4 }, new MergeByTestItem { Id = 12 }, new MergeByTestItem { Id = 41 } }; var c = new MergeByTestItem[] { new MergeByTestItem { Id = 3 }, new MergeByTestItem { Id = 22 }, new MergeByTestItem { Id = 30 }, new MergeByTestItem { Id = 37 }, new MergeByTestItem { Id = 43 }, }; var combined = new MergeByTestItem[][] { a, b, c }; var mergeOrdered = combined.MergeOrderedBy(m => m.Id); Assert.AreEqual(expectedLast, mergeOrdered.Last().Id); }
public void MergeByOrderedByDescendingCombinesSequences() { const int expectedCount = 14; var a = new MergeByTestItem[] { new MergeByTestItem { Id = 40 }, new MergeByTestItem { Id = 19 }, new MergeByTestItem { Id = 13 }, new MergeByTestItem { Id = 8 }, new MergeByTestItem { Id = 1 }, }; var b = new MergeByTestItem[] { new MergeByTestItem { Id = 41 }, new MergeByTestItem { Id = 12 }, new MergeByTestItem { Id = 4 }, new MergeByTestItem { Id = 0 } }; var c = new MergeByTestItem[] { new MergeByTestItem { Id = 43 }, new MergeByTestItem { Id = 37 }, new MergeByTestItem { Id = 30 }, new MergeByTestItem { Id = 22 }, new MergeByTestItem { Id = 3 }, }; var combined = new MergeByTestItem[][] { a, b, c }; var mergeOrdered = combined.MergeOrderedByDescending(m => m.Id); Assert.AreEqual(expectedCount, mergeOrdered.Count()); }