public void SortedMaxSizedContainerOnlySmallestItemsRemain() { SortedMaxSizedContainer <int> container = new SortedMaxSizedContainer <int>(5) { 7, 6, 5, 4, 3, 2, 1 }; int[] data = container.ToArray(); Assert.AreEqual(data, new[] { 1, 2, 3, 4, 5 }); }
public void SortedMaxSizedContainerInverseComparer() { SortedMaxSizedContainer <int> container = new SortedMaxSizedContainer <int>(5, Comparer <int> .Create((a, b) => b.CompareTo(a))) { 7, 6, 5, 4, 3, 2, 1 }; int[] data = container.ToArray(); Assert.AreEqual(data, new[] { 7, 6, 5, 4, 3 }); }
public void SortedMaxSizedContainerRemoveDuplicateItemCorrectCollection() { SortedMaxSizedContainer <int> container = new SortedMaxSizedContainer <int>(5) { 1, 1, 1, 1, 1, 1, 1 }; container.Remove(1); int[] data = container.ToArray(); Assert.AreEqual(data, new[] { 1, 1, 1, 1 }); }
public void SortedMaxSizedContainerRemoveFirstItemCorrectCollection() { SortedMaxSizedContainer <int> container = new SortedMaxSizedContainer <int>(5) { 7, 6, 5, 4, 3, 2, 1 }; container.Remove(1); int[] data = container.ToArray(); Assert.AreEqual(data, new[] { 2, 3, 4, 5 }); }
public void SortedMaxSizedContainerInverseComparer() { SortedMaxSizedContainer<int> container = new SortedMaxSizedContainer<int>(5, Comparer<int>.Create((a, b) => b.CompareTo(a))) { 7, 6, 5, 4, 3, 2, 1 }; int[] data = container.ToArray(); Assert.AreEqual(data, new[] { 7, 6, 5, 4, 3 }); }
public void SortedMaxSizedContainerRemoveNonExistentItemCorrectCollection() { SortedMaxSizedContainer<int> container = new SortedMaxSizedContainer<int>(5) { 7, 6, 5, 4, 3, 2, 1 }; container.Remove(8); int[] data = container.ToArray(); Assert.AreEqual(data, new[] { 1, 2, 3, 4, 5 }); }
public void SortedMaxSizedContainerRemoveDuplicateItemCorrectCollection() { SortedMaxSizedContainer<int> container = new SortedMaxSizedContainer<int>(5) { 1, 1, 1, 1, 1, 1, 1 }; container.Remove(1); int[] data = container.ToArray(); Assert.AreEqual(data, new[] { 1, 1, 1, 1 }); }
public void SortedMaxSizedContainerOnlySmallestItemsRemain() { SortedMaxSizedContainer<int> container = new SortedMaxSizedContainer<int>(5) { 7, 6, 5, 4, 3, 2, 1 }; int[] data = container.ToArray(); Assert.AreEqual(data, new[] { 1, 2, 3, 4, 5 }); }