示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldGrowArray()
        internal virtual void ShouldGrowArray()
        {
            // GIVEN
            PrimitiveIntStack stack = new PrimitiveIntStack(5);

            // WHEN
            for (int i = 0; i <= 7; i++)
            {
                stack.Push(i);
            }

            // THEN
            for (int i = 7; i >= 0; i--)
            {
                assertFalse(stack.Empty);
                assertEquals(i, stack.Poll());
            }
            assertTrue(stack.Empty);
            assertEquals(-1, stack.Poll());
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldIterate()
        internal virtual void ShouldIterate()
        {
            // GIVEN
            PrimitiveIntStack stack = new PrimitiveIntStack();

            // WHEN
            for (int i = 0; i < 7; i++)
            {
                stack.Push(i);
            }

            // THEN
            PrimitiveIntIterator iterator = stack.GetEnumerator();
            int i = 0;

            while (iterator.HasNext())
            {
                assertEquals(i++, iterator.Next());
            }
            assertEquals(7, i);
        }
示例#3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldPushAndPollSomeEntities()
        internal virtual void ShouldPushAndPollSomeEntities()
        {
            // GIVEN
            PrimitiveIntStack stack = new PrimitiveIntStack(6);

            // WHEN/THEN
            assertTrue(stack.Empty);
            assertEquals(-1, stack.Poll());

            stack.Push(123);
            assertFalse(stack.Empty);

            stack.Push(456);
            assertFalse(stack.Empty);
            assertEquals(456, stack.Poll());

            assertFalse(stack.Empty);
            assertEquals(123, stack.Poll());

            assertTrue(stack.Empty);
            assertEquals(-1, stack.Poll());
        }