public void InnerStreamIsWrappedByMarkableStream() { using (var stream = new TrackingStream(new MemoryStream(_content))) { stream.AsMarkable(); Reflector.GetProperty(stream, "InnerStream").Should().BeOfType <MarkableForwardOnlyEventingReadStream>(); } }
public void CaptureSetupResetMarkablePosition() { using (var stream = new TrackingStream(new MemoryStream(_content))) { var ms = stream.AsMarkable(); ms.Drain(); stream.Position.Should().Be(_content.Length); stream.SetupCapture(new MessageBodyCaptureDescriptor("some-data", MessageBodyCaptureMode.Unclaimed)); stream.Position.Should().Be(0); } }
public void EventsAreNotFiredThroughMarkableInnerStream() { using (var stream = new TrackingStream(new MemoryStream(_content))) { var edgeEventsCount = 0; stream.AfterLastReadEvent += (_, _) => ++ edgeEventsCount; stream.BeforeFirstReadEvent += (_, _) => ++ edgeEventsCount; var eventsCount = 0; stream.ReadEvent += (_, _) => ++ eventsCount; var markableForwardOnlyEventingReadStream = stream.AsMarkable(); edgeEventsCount.Should().Be(0); eventsCount.Should().Be(0); markableForwardOnlyEventingReadStream.Drain(); edgeEventsCount.Should().Be(0); eventsCount.Should().Be(0); } }