Пример #1
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()
        {
            DefaultComparatorTopTable <long> table = new DefaultComparatorTopTable <long>(_comparator, 5);

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

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

            Exception.expect(typeof(System.InvalidOperationException));
            table.GetEnumerator();
        }
Пример #2
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()
        {
            DefaultComparatorTopTable <long> table = new DefaultComparatorTopTable <long>(_comparator, 20);

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

            table.Sort();

            IEnumerator <long> 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 = 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());
        }