//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); }
//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); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldTrackOffsetByteArrayWrites() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldTrackOffsetByteArrayWrites() { // given Stream actual = mock(typeof(Stream)); ProgressListener progressListener = mock(typeof(ProgressListener)); ProgressTrackingOutputStream.Progress progress = new ProgressTrackingOutputStream.Progress(progressListener, 0); int length = 5; using (ProgressTrackingOutputStream @out = new ProgressTrackingOutputStream(actual, progress)) { // when @out.Write(new sbyte[length * 2], 2, length); } progress.Done(); // then verify(progressListener).add(length); verify(progressListener).done(); verifyNoMoreInteractions(progressListener); }