Fluent Assertions Documentation
In This Topic
    Streams
    In This Topic

    Streams

    C#
    Copy Code
    var stream = new MemoryStream(new byte[1024], writable: false);
    
    stream.Should().NotBeWritable();
    stream.Should().BeReadable();
    stream.Should().BeReadOnly();
    stream.Should().BeSeekable();
    
    stream.Should().HaveLength(1024);
    stream.Should().HavePosition(0);

    There are also additional assertions for BufferedStream.

    C#
    Copy Code
    var stream = new BufferedStream(new MemoryStream(), 1024)
    
    subject.Should().HaveBufferSize(1024);
    subject.Should().NotHaveBufferSize(2048);