Example #1
0
        public void Stack_Generic_Constructor_int(int count)
        {
            PooledStack <T> stack = new PooledStack <T>(count);

            RegisterForDispose(stack);
            Assert.Equal(Array.Empty <T>(), stack.ToArray());
        }
Example #2
0
        public void Stack_Generic_Constructor_IEnumerable(EnumerableType enumerableType, int setLength, int enumerableLength, int numberOfMatchingElements, int numberOfDuplicateElements)
        {
            IEnumerable <T> enumerable = CreateEnumerable(enumerableType, null, enumerableLength, 0, numberOfDuplicateElements);
            PooledStack <T> stack      = new PooledStack <T>(enumerable);

            RegisterForDispose(stack);
            Assert.Equal(enumerable.ToArray().Reverse(), stack.ToArray());
        }
Example #3
0
        public void Stack_Generic_Constructor_InitialValues()
        {
            var stack = new PooledStack <T>();

            Assert.Equal(0, stack.Count);
            Assert.Equal(0, stack.ToArray().Length);
            Assert.NotNull(((ICollection)stack).SyncRoot);
        }
Example #4
0
        public void Stack_Generic_ToArray(int count)
        {
            PooledStack <T> stack = GenericStackFactory(count);

            Assert.Equal(Enumerable.ToArray(stack), stack.ToArray());
        }