public void SourceStreamCannotBeSoughtBeforeExhaustion()
 {
     using (var stream = new ReplicatingReadStream(new MemoryStream(_content), new MemoryStream()))
     {
         stream.CanSeek.Should().BeFalse();
         // don't drain the whole stream
         stream.Read(new byte[1024], 0, 1024);
         Action act = () => stream.Position = 0;
         act.Should().Throw <InvalidOperationException>()
         .WithMessage($"{typeof(ReplicatingReadStream).Name} is not seekable while the inner stream has not been thoroughly read and replicated.");
         act = () => stream.Seek(0, SeekOrigin.Begin);
         act.Should().Throw <InvalidOperationException>()
         .WithMessage($"{typeof(ReplicatingReadStream).Name} cannot be sought while the inner stream has not been thoroughly read and replicated.");
     }
 }
 public void SourceStreamCannotBeSoughtBeforeExhaustion()
 {
     using (var stream = new ReplicatingReadStream(new MemoryStream(_content), new MemoryStream()))
     {
         Assert.That(stream.CanSeek, Is.False);
         // don't drain the whole stream
         stream.Read(new byte[1024], 0, 1024);
         Assert.That(
             () => stream.Position = 0,
             Throws.InstanceOf <InvalidOperationException>()
             .With.Message.EqualTo(
                 string.Format("{0} is not seekable while the inner stream has not been thoroughly read and replicated.", typeof(ReplicatingReadStream).Name)));
         Assert.That(
             () => stream.Seek(0, SeekOrigin.Begin),
             Throws.InstanceOf <InvalidOperationException>()
             .With.Message.EqualTo(
                 string.Format("{0} cannot be sought while the inner stream has not been thoroughly read and replicated.", typeof(ReplicatingReadStream).Name)));
     }
 }