コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void closeResource()
        public virtual void CloseResource()
        {
            Resource resource = Mockito.mock(typeof(Resource));
            PrimitiveLongResourceIterator source = resourceIterator(ImmutableEmptyLongIterator.INSTANCE, resource);

            PrimitiveLongResourceIterator iterator = DiffApplyingPrimitiveLongIterator.Augment(source, LongSets.immutable.empty(), LongSets.immutable.empty());

            iterator.Close();

            Mockito.verify(resource).close();
        }
コード例 #2
0
        // ITERATOR

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void simpleIterator()
        internal virtual void SimpleIterator()
        {
            // Given
            CountingResource resource = new CountingResource();
            PrimitiveLongResourceIterator iterator = PrimitiveLongResourceCollections.Iterator(resource, 1, 2, 3, 4);

            // Then
            AssertContent(iterator, 1, 2, 3, 4);

            // When
            iterator.Close();

            // Then
            assertEquals(1, resource.CloseCount(), "exactly one call to close");
        }
コード例 #3
0
        // FILTER

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void filterItems()
        internal virtual void FilterItems()
        {
            // Given
            CountingResource resource = new CountingResource();
            PrimitiveLongResourceIterator iterator = PrimitiveLongResourceCollections.Iterator(resource, 1, 2, 3, 4);

            // When
            PrimitiveLongResourceIterator filtered = PrimitiveLongResourceCollections.Filter(iterator, _even);

            // Then
            AssertContent(filtered, 2, 4);

            // When
            filtered.Close();

            // Then
            assertEquals(1, resource.CloseCount(), "exactly one call to close");
        }
コード例 #4
0
        // FILTER

        // CONCAT

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void concatIterators()
        internal virtual void ConcatIterators()
        {
            // Given
            CountingResource resource            = new CountingResource();
            PrimitiveLongResourceIterator first  = PrimitiveLongResourceCollections.Iterator(resource, 1, 2);
            PrimitiveLongResourceIterator second = PrimitiveLongResourceCollections.Iterator(resource, 3, 4);

            // When
            PrimitiveLongResourceIterator concat = PrimitiveLongResourceCollections.Concat(first, second);

            // Then
            AssertContent(concat, 1, 2, 3, 4);

            // When
            concat.Close();

            // Then
            assertEquals(2, resource.CloseCount(), "all concatenated iterators are closed");
        }