Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldHandleReadAheadEmptyData() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldHandleReadAheadEmptyData()
        {
            // GIVEN
            TrackingReader actual        = new TrackingReader(0);
            int            bufferSize    = 10;
            CharReadable   aheadReadable = ThreadAheadReadable.ThreadAhead(actual, bufferSize);

            // WHEN
            actual.AwaitCompletedReadAttempts(1);

            // THEN
            SectionedCharBuffer buffer = new SectionedCharBuffer(bufferSize);

            buffer = aheadReadable.Read(buffer, buffer.Front());
            assertEquals(buffer.Pivot(), buffer.Back());
            assertEquals(buffer.Pivot(), buffer.Front());
        }
Exemplo n.º 2
0
 private static void AssertBuffer(char[] expectedChars, SectionedCharBuffer buffer, int charsInBack, int charsInFront)
 {
     assertEquals(buffer.Pivot() - charsInBack, buffer.Back());
     assertEquals(buffer.Pivot() + charsInFront, buffer.Front());
     assertArrayEquals(expectedChars, copyOfRange(buffer.Array(), buffer.Back(), buffer.Front()));
 }