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
|
|
|
{
|
2026-03-24 11:10:27 -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();
|
2026-03-24 11:10:27 -04:00
|
|
|
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]);
|
2026-03-24 11:10:27 -04:00
|
|
|
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);
|
2026-03-24 11:10:27 -04:00
|
|
|
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
|
|
|
}
|