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 shouldTrackOffsetAfterRewind() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldTrackOffsetAfterRewind()
        {
            // given
            Stream           actual           = mock(typeof(Stream));
            ProgressListener progressListener = mock(typeof(ProgressListener));

            ProgressTrackingOutputStream.Progress progress = new ProgressTrackingOutputStream.Progress(progressListener, 0);
            using (ProgressTrackingOutputStream @out = new ProgressTrackingOutputStream(actual, progress))
            {
                @out.WriteByte(new sbyte[20]);

                // when
                progress.RewindTo(15);                           // i.e. the next 5 bytes we don't track
                @out.WriteByte(new sbyte[3]);                    // now there should be 2 untracked bytes left
                @out.WriteByte(new sbyte[9]);                    // this one should report 7
            }
            progress.Done();

            // then
            InOrder inOrder = inOrder(progressListener);

            inOrder.verify(progressListener).add(20);
            inOrder.verify(progressListener).add(7);
            inOrder.verify(progressListener).done();
            verifyNoMoreInteractions(progressListener);
        }
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 shouldTrackSingleByteWrites() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldTrackSingleByteWrites()
        {
            // given
            Stream           actual           = mock(typeof(Stream));
            ProgressListener progressListener = mock(typeof(ProgressListener));

            ProgressTrackingOutputStream.Progress progress = new ProgressTrackingOutputStream.Progress(progressListener, 0);
            using (ProgressTrackingOutputStream @out = new ProgressTrackingOutputStream(actual, progress))
            {
                // when
                @out.WriteByte(10);
            }
            progress.Done();

            // then
            verify(progressListener).add(1);
            verify(progressListener).done();
            verifyNoMoreInteractions(progressListener);
        }
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 shouldTrackByteArrayWrites() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldTrackByteArrayWrites()
        {
            // given
            Stream           actual           = mock(typeof(Stream));
            ProgressListener progressListener = mock(typeof(ProgressListener));

            ProgressTrackingOutputStream.Progress progress = new ProgressTrackingOutputStream.Progress(progressListener, 0);
            int length = 14;

            using (ProgressTrackingOutputStream @out = new ProgressTrackingOutputStream(actual, progress))
            {
                // when
                @out.WriteByte(new sbyte[length]);
            }
            progress.Done();

            // then
            verify(progressListener).add(length);
            verify(progressListener).done();
            verifyNoMoreInteractions(progressListener);
        }