public void ReadBlockCharArr() { (char[] chArr, CharArrayTextReader textReader)baseInfo = GetCharArray(); using (CharArrayTextReader tr = baseInfo.textReader) { char[] chArr = new char[baseInfo.chArr.Length]; var read = tr.ReadBlock(chArr, 0, chArr.Length); Assert.Equal(chArr.Length, read); for (int count = 0; count < baseInfo.chArr.Length; ++count) { Assert.Equal(baseInfo.chArr[count], chArr[count]); } } }
public void ReadBlockSpan() { (char[] chArr, CharArrayTextReader textReader)baseInfo = GetCharArray(); using (CharArrayTextReader tr = baseInfo.textReader) { char[] chArr = new char[baseInfo.chArr.Length]; var chSpan = new Span <char>(chArr, 0, baseInfo.chArr.Length); var read = tr.ReadBlock(chSpan); Assert.Equal(chArr.Length, read); for (int i = 0; i < baseInfo.chArr.Length; i++) { Assert.Equal(baseInfo.chArr[i], chArr[i]); } } }