public void CrashingSubscriberHandledCorrectlyTest() { var hostConfiguration = new HostConfiguration(publishScheduler: Scheduler.Immediate); var configuration = RxLoggerConfiguration.Create(hostConfiguration); RxLogEntry lastValueSub1 = null; RxLogEntry lastValueSub2 = null; configuration.AddSubscriber((c, en) => TestSubscriber(c, en, (r) => lastValueSub1 = r, raiseException: true)); configuration.AddSubscriber((c, en) => TestSubscriber(c, en, (r) => lastValueSub2 = r)); // one subscription we will let it raise exceptions, other won't. var entry1 = RxLogEntry.WithNoMeta(new object()); var entry2 = RxLogEntry.WithNoMeta(new object()); var host = new RxObservableLogHost(configuration); host.Publish(entry1); Assert.Null(lastValueSub1); Assert.Same(entry1, lastValueSub2); host.Publish(entry2); Assert.Null(lastValueSub1); Assert.Same(entry2, lastValueSub2); }
public void PublishedItemsChanneledThroughConfigTest() { var hostConfiguration = new HostConfiguration(prePumpObservable: (e) => PumpTest(e), publishScheduler: Scheduler.Immediate); var configuration = RxLoggerConfiguration.Create(hostConfiguration: hostConfiguration); var host = new RxObservableLogHost(configuration); var entry = RxLogEntry.WithNoMeta(new object()); host.Publish(entry); Assert.Same(entry, _lastValue); }
public void SubscribersCorrectlySubscribedTest() { var hostConfiguration = new HostConfiguration(prePumpObservable: (e) => PumpTest(e, false), publishScheduler: Scheduler.Immediate); var configuration = RxLoggerConfiguration.Create(hostConfiguration: hostConfiguration); RxLogEntry lastValue = default(RxLogEntry); configuration.AddSubscriber((c, en) => TestSubscriber(c, en, (v) => lastValue = v)); var host = new RxObservableLogHost(configuration); var entry = RxLogEntry.WithNoMeta(new object()); host.Publish(entry); Assert.Same(entry, lastValue); }
public void PublishedItemsCanBeFilteredTest() { // indicate that pump shouldn't pass through messages var hostConfiguration = new HostConfiguration(prePumpObservable: (e) => PumpTest(e, ignoreAll: true), publishScheduler: Scheduler.Immediate); var configuration = RxLoggerConfiguration.Create(hostConfiguration: hostConfiguration); RxLogEntry lastSubValue = default(RxLogEntry); configuration.AddSubscriber((c, en) => TestSubscriber(c, en, (r) => lastSubValue = r, raiseException: true)); var host = new RxObservableLogHost(configuration); var entry = RxLogEntry.WithNoMeta(new object()); host.Publish(entry); // verify not received anything. Assert.Null(lastSubValue); }
public void ErrorsDuringProcessingPassedToErrorHandlerTest() { Exception lastException = null; var hostConfiguration = new HostConfiguration(prePumpObservable: (e) => PumpTest(e, true), publishScheduler: Scheduler.Immediate, errored: (e) => { lastException = e; return(Observable.Return(Unit.Default)); }); var configuration = RxLoggerConfiguration.Create(hostConfiguration: hostConfiguration); var host = new RxObservableLogHost(configuration); var entry = RxLogEntry.WithNoMeta(new object()); host.Publish(entry); Assert.NotNull(lastException); }