public void EnsureCapacity_Generic_ExistingCapacityRequested_SameValueReturned(int capacity)
        {
            var dictionary = new SegmentedDictionary <TKey, TValue>(capacity);

            Assert.True(dictionary.EnsureCapacity(capacity) > capacity);

            dictionary = (SegmentedDictionary <TKey, TValue>)GenericIDictionaryFactory(capacity);
            Assert.True(dictionary.EnsureCapacity(capacity) > capacity);
        }
        public void EnsureCapacity_Generic_RequestedCapacitySmallerThanCurrent_CapacityUnchanged(int currentCapacity)
        {
            SegmentedDictionary <TKey, TValue> dictionary;

            // assert capacity remains the same when ensuring a capacity smaller or equal than existing
            for (int i = 0; i <= currentCapacity; i++)
            {
                dictionary = new SegmentedDictionary <TKey, TValue>(currentCapacity);
                Assert.True(dictionary.EnsureCapacity(i) > currentCapacity);
            }
        }
        public void EnsureCapacity_Generic_DictionaryNotInitialized_RequestedZero_ReturnsZero()
        {
            var dictionary = new SegmentedDictionary <TKey, TValue>();

            Assert.Equal(0, dictionary.EnsureCapacity(0));
        }
        public void EnsureCapacity_Generic_DictionaryNotInitialized_RequestedNonZero_CapacityIsSetToAtLeastTheRequested(int requestedCapacity)
        {
            var dictionary = new SegmentedDictionary <TKey, TValue>();

            Assert.InRange(dictionary.EnsureCapacity(requestedCapacity), requestedCapacity, int.MaxValue);
        }
        public void EnsureCapacity_Generic_NegativeCapacityRequested_Throws()
        {
            var dictionary = new SegmentedDictionary <TKey, TValue>();

            AssertExtensions.Throws <ArgumentOutOfRangeException>("capacity", () => dictionary.EnsureCapacity(-1));
        }