Exemplo n.º 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()
        {
            DefaultComparatorTopTable <long> table = new DefaultComparatorTopTable <long>(_comparator, 10);

            table.Sort();

            IEnumerator <long> 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());
        }
Exemplo n.º 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()
        {
            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();
        }
Exemplo n.º 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()
        {
            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());
        }
Exemplo n.º 4
0
 public IteratorAnonymousInnerClass(DefaultComparatorTopTable <T> outerInstance)
 {
     this.outerInstance = outerInstance;
     cursor             = outerInstance.count;
 }