예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleWhenEmpty()
        public virtual void ShouldHandleWhenEmpty()
        {
            DefaultTopTable table = new DefaultTopTable(10);

            table.sort();

            IEnumerator <object> iterator = table.GetEnumerator();

//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertFalse(iterator.hasNext());
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldThrowOnSortNotCalledBeforeIterator()
        public virtual void ShouldThrowOnSortNotCalledBeforeIterator()
        {
            DefaultTopTable table = new DefaultTopTable(5);

            foreach (long?i in _testValues)
            {
                table.add(i);
            }

            // We forgot to call sort() here...

            Exception.expect(typeof(System.InvalidOperationException));
            table.GetEnumerator();
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleWhenNotCompletelyFilledToCapacity()
        public virtual void ShouldHandleWhenNotCompletelyFilledToCapacity()
        {
            DefaultTopTable table = new DefaultTopTable(20);

            foreach (long?i in _testValues)
            {
                table.add(i);
            }

            table.sort();

            IEnumerator <object> iterator = table.GetEnumerator();

            for (int i = 0; i < _testValues.Length; i++)
            {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertTrue(iterator.hasNext());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                long value = ( long )iterator.next();
                assertEquals(_expectedValues[i], value);
            }
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertFalse(iterator.hasNext());
        }