public void ShouldPerformBinarySearchWithComparer() { CategoryItemMock item1 = new CategoryItemMock("a"); CategoryItemMock item2 = new CategoryItemMock("b"); GridEntryCollection <CategoryItemMock> list = new GridEntryCollection <CategoryItemMock>(); list.Add(item1); list.Add(item2); Assert.AreEqual <int>(0, list.BinarySearch(item1, new CategoryItemMockComparer())); Assert.AreEqual <int>(1, list.BinarySearch(item2, new CategoryItemMockComparer())); }
public void ShouldPerformBinarySearch() { CategoryItemMock item1 = new CategoryItemMock("a"); CategoryItemMock item2 = new CategoryItemMock("b"); GridEntryCollection <CategoryItemMock> list = new GridEntryCollection <CategoryItemMock>(); list.Add(item1); list.Add(item2); int result = list.BinarySearch(item1); Assert.AreEqual <int>(0, result); result = list.BinarySearch(item2); Assert.AreEqual <int>(1, result); }