public void Stops_flushing_messages_on_first_exception() { // Arrange var client = new Mock<IEventSourceRavenClient>(); var breakingEntry = CreateTestEntry(); client.Setup(x => x.CaptureEventEntry(It.Is<EventEntry>(e => e != breakingEntry), It.IsAny<ISentryExceptionLocator>())) .Verifiable(); client.Setup(x => x.CaptureEventEntry(breakingEntry, It.IsAny<ISentryExceptionLocator>())) .Throws(new WebException()); var sink = new SentrySink(client.Object, Buffering.DefaultBufferingInterval, Buffering.DefaultBufferingCount, Buffering.DefaultMaxBufferSize, Timeout.InfiniteTimeSpan); // Act sink.OnNext(CreateTestEntry()); sink.OnNext(breakingEntry); sink.OnNext(CreateTestEntry()); sink.OnCompleted(); // Assert client.Verify( x => x.CaptureEventEntry(It.Is<EventEntry>(e => e != breakingEntry), It.IsAny<ISentryExceptionLocator>()), Times.Exactly(1) ); }
public SentrySink GetSut() { var sut = new SentrySink(null, InitAction, Hub) { Dsn = Dsn }; return(sut); }
public async Task Flushes_messages_to_raven_client() { // Arrange var client = new Mock<IEventSourceRavenClient>(); client.Setup(x => x.CaptureEventEntry(It.IsAny<EventEntry>(), It.IsAny<ISentryExceptionLocator>())).Verifiable(); var sink = new SentrySink(client.Object, Buffering.DefaultBufferingInterval, Buffering.DefaultBufferingCount, Buffering.DefaultMaxBufferSize, Timeout.InfiniteTimeSpan); // Act sink.OnNext(CreateTestEntry()); sink.OnNext(CreateTestEntry()); sink.OnNext(CreateTestEntry()); await sink.FlushAsync(); // Assert client.Verify( x => x.CaptureEventEntry(It.IsAny<EventEntry>(), It.IsAny<ISentryExceptionLocator>()), Times.Exactly(3) ); }