Files
SabreTools.IO/SabreTools.IO.Test/BufferedStreamReaderTests.cs

41 lines
1.1 KiB
C#
Raw Permalink Normal View History

2025-09-22 10:50:53 -04:00
using System.IO;
using Xunit;
2026-03-18 14:24:01 -04:00
namespace SabreTools.IO.Test
2025-09-22 10:50:53 -04:00
{
public class BufferedStreamReaderTests
2025-09-22 10:50:53 -04:00
{
#region ReadNextByte
[Fact]
public void ReadNextByte_Empty_Null()
{
var source = new MemoryStream();
var stream = new BufferedStreamReader(source);
2025-09-22 10:50:53 -04:00
byte? actual = stream.ReadNextByte();
Assert.Null(actual);
}
[Fact]
public void ReadNextByte_Filled_ValidPosition_Byte()
{
var source = new MemoryStream(new byte[1024]);
var stream = new BufferedStreamReader(source);
2025-09-22 10:50:53 -04:00
byte? actual = stream.ReadNextByte();
Assert.Equal((byte)0x00, actual);
}
[Fact]
public void ReadNextByte_Filled_InvalidPosition_Null()
{
var source = new MemoryStream(new byte[1024]);
source.Seek(0, SeekOrigin.End);
var stream = new BufferedStreamReader(source);
2025-09-22 10:50:53 -04:00
byte? actual = stream.ReadNextByte();
Assert.Null(actual);
}
#endregion
}
2025-11-13 08:56:30 -05:00
}