public void CaptureThrowsWhenNoCapturingStream()
 {
     using (var stream = new TrackingStream(new MemoryStream(_content), new MessageBodyCaptureDescriptor("url", MessageBodyCaptureMode.Claimed)))
     {
         Invoking(() => stream.Capture()).Should().Throw <InvalidOperationException>()
         .WithMessage("TrackingStream cannot be captured unless it has been setup with another capturing stream to replicate its payload to.");
     }
 }
 public void CaptureThrowsWhenNoCaptureDescriptor()
 {
     using (var stream = new TrackingStream(new MemoryStream(_content)))
     {
         Invoking(() => stream.Capture()).Should().Throw <InvalidOperationException>()
         .WithMessage("TrackingStream cannot be captured because its Descriptor is null and has not been initialized for tracking.");
     }
 }
 public void CaptureThrowsWhenCaptureModeIsNotClaimed()
 {
     using (var stream = new TrackingStream(new MemoryStream(_content)))
     {
         stream.SetupCapture(new MessageBodyCaptureDescriptor("some-data", MessageBodyCaptureMode.Unclaimed));
         Invoking(() => stream.Capture()).Should().Throw <InvalidOperationException>()
         .WithMessage("TrackingStream cannot be captured because its Descriptor's CaptureMode has not been set to Claimed but to Unclaimed.");
     }
 }
 public void CaptureDrainsInnerStream()
 {
     using (var innerStream = new MemoryStream(_content))
         using (var stream = new TrackingStream(innerStream))
         {
             stream.SetupCapture(new MessageBodyCaptureDescriptor("some-data", MessageBodyCaptureMode.Claimed), new MemoryStream());
             innerStream.Position.Should().Be(0);
             Invoking(() => stream.Capture()).Should().NotThrow();
             innerStream.Position.Should().Be(innerStream.Length);
         }
 }