예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldExtractOnlyLine() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldExtractOnlyLine()
        {
            // given
            string       firstLine = "characters of only line";
            CharReadable reader    = Readables.Wrap(firstLine);

            // when
            char[] firstLineCharacters = Readables.ExtractFirstLineFrom(reader);
            int    readAfterwards      = reader.Read(new char[1], 0, 1);

            // then
            assertArrayEquals(firstLine.ToCharArray(), firstLineCharacters);
            assertEquals(-1, readAfterwards);
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldExtractFirstLine() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldExtractFirstLine()
        {
            // given
            string       firstLine  = "characters of first line";
            string       secondLine = "here on the second line";
            CharReadable reader     = Readables.Wrap(firstLine + "\n" + secondLine);

            // when
            char[] firstLineCharacters  = Readables.ExtractFirstLineFrom(reader);
            char[] secondLineCharacters = new char[secondLine.Length];
            reader.Read(secondLineCharacters, 0, secondLineCharacters.Length);

            // then
            assertArrayEquals(firstLine.ToCharArray(), firstLineCharacters);
            assertArrayEquals(secondLine.ToCharArray(), secondLineCharacters);
        }