コード例 #1
0
        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 });
        }
コード例 #2
0
        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 });
        }
コード例 #3
0
        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 });
        }
コード例 #4
0
        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 });
        }
コード例 #5
0
        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 });
        }
コード例 #6
0
 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 });
 }
コード例 #7
0
 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 });
 }
コード例 #8
0
 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 });
 }