public void SetLengthShouldNotBeAllowed()
        {
            // arrange
            var stream = new EmptyStream(0L);

            // act
            var ex = Assert.Throws <NotSupportedException>(() => stream.SetLength(100L));

            // assert
        }
        public void SeekShouldNotAllowOffsetOutOfRange(long length, long offset, SeekOrigin origin)
        {
            // arrange
            var stream = new EmptyStream(length);

            // act
            var ex = Assert.Throws <ArgumentOutOfRangeException>(() => stream.Seek(offset, origin));

            // assert
            Assert.Equal(nameof(offset), ex.ParamName);
        }
        public void PositionShouldNotAllowValueOutOfRange(long length, long position)
        {
            // arrange
            var stream = new EmptyStream(length);

            // act
            var ex = Assert.Throws <ArgumentOutOfRangeException>(() => stream.Position = position);

            // assert
            Assert.Equal("value", ex.ParamName);
        }
        public void SeekShouldMoveToExpectedPosition(long length, long offset, SeekOrigin origin, long expected)
        {
            // arrange
            var stream = new EmptyStream(length);

            // act
            var actual = stream.Seek(offset, origin);

            // assert
            Assert.Equal(expected, actual);
        }
        public void ConstructorShouldSetExpectedLength()
        {
            // arrange
            var length = 100L;

            // act
            var stream = new EmptyStream(length);

            // assert
            Assert.Equal(length, stream.Length);
        }
        public void WriteShouldNotBeAllowed()
        {
            // arrange
            var buffer = new byte[100];
            var stream = new EmptyStream(0L);

            // act
            var ex = Assert.Throws <NotSupportedException>(() => stream.Write(buffer, 0, buffer.Length));

            // assert
        }
        public void CanWriteShouldBeFalse()
        {
            // arrange
            var expected = false;
            var stream   = new EmptyStream(0L);

            // act
            var actual = stream.CanWrite;

            // assert
            Assert.Equal(expected, actual);
        }
        public void CanSeekShouldBeTrue()
        {
            // arrange
            var expected = true;
            var stream   = new EmptyStream(0L);

            // act
            var actual = stream.CanSeek;

            // assert
            Assert.Equal(expected, actual);
        }
        public void PositionShouldBeUpdateableWithinRange()
        {
            // arrange
            var expected = 50L;
            var stream   = new EmptyStream(100L);

            // act
            stream.Position = expected;
            var actual = stream.Position;

            // assert
            Assert.Equal(expected, actual);
        }
        public void ReadShouldConsumeStream(int size, long length)
        {
            // arrange
            var expected = length - 1;
            var buffer   = new byte[size];
            var stream   = new EmptyStream(length);
            var count    = 0;

            // act
            while ((count = stream.Read(buffer, 0, size)) > 0)
            {
                ;
            }

            var actual = stream.Position;

            // assert
            Assert.Equal(expected, actual);
        }