예제 #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());
        }
예제 #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());
        }
예제 #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);
        }
예제 #4
0
        public void Stack_Generic_ToArray(int count)
        {
            PooledStack <T> stack = GenericStackFactory(count);

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