public void OmitsEventsFromSourcesDisabledByNamePrefix()
        {
            var healthReporterMock = new Mock <IHealthReporter>();

            var inputConfiguration = new List <EventSourceConfiguration>();

            inputConfiguration.Add(new EventSourceConfiguration()
            {
                ProviderNamePrefix = "EventSourceInput-Other"
            });

            var observer = new Mock <IObserver <EventData> >();

            using (var otherSource = new EventSourceInputTestOtherSource())
            {
                using (var eventSourceInput = new EventSourceInput(inputConfiguration, healthReporterMock.Object))
                {
                    eventSourceInput.Activate();

                    using (eventSourceInput.Subscribe(observer.Object))
                    {
                        otherSource.Message("Hey!");

                        observer.Verify(s => s.OnNext(It.IsAny <EventData>()), Times.Exactly(1));

                        healthReporterMock.Verify(o => o.ReportWarning(It.IsAny <string>(), It.IsAny <string>()), Times.Never());
                        healthReporterMock.Verify(o => o.ReportProblem(It.IsAny <string>(), It.IsAny <string>()), Times.Never());
                    }
                }

                inputConfiguration.Add(new EventSourceConfiguration()
                {
                    DisabledProviderNamePrefix = "EventSourceInput-Other"
                });
                observer.ResetCalls();

                using (var eventSourceInput = new EventSourceInput(inputConfiguration, healthReporterMock.Object))
                {
                    eventSourceInput.Activate();

                    using (eventSourceInput.Subscribe(observer.Object))
                    {
                        otherSource.Message("You!");

                        observer.Verify(s => s.OnNext(It.IsAny <EventData>()), Times.Exactly(0));  // Source disabled--should get zero events out of the input

                        healthReporterMock.Verify(o => o.ReportWarning(It.IsAny <string>(), It.IsAny <string>()), Times.Never());
                        healthReporterMock.Verify(o => o.ReportProblem(It.IsAny <string>(), It.IsAny <string>()), Times.Never());
                    }
                }
            }
        }
        public void CapturesEventsFromEventSourceCreatedAfterInputCreated()
        {
            var healthReporterMock = new Mock <IHealthReporter>();

            var inputConfiguration = new List <EventSourceConfiguration>();

            inputConfiguration.Add(new EventSourceConfiguration()
            {
                ProviderName = "EventSourceInput-OtherTestEventSource"
            });

            var eventSourceInput = new EventSourceInput(inputConfiguration, healthReporterMock.Object);

            eventSourceInput.Activate();

            var observer = new Mock <IObserver <EventData> >();

            using (eventSourceInput.Subscribe(observer.Object))
                using (var eventSource = new EventSourceInputTestOtherSource())
                {
                    eventSource.Message("Wow!");

                    observer.Verify(s => s.OnNext(It.Is <EventData>(data =>
                                                                    data.Payload["Message"].Equals("Wow!") &&
                                                                    data.Payload["EventId"].Equals(3) &&
                                                                    data.Payload["EventName"].Equals("Message")
                                                                    )), Times.Exactly(1));

                    healthReporterMock.Verify(o => o.ReportWarning(It.IsAny <string>(), It.IsAny <string>()), Times.Never());
                    healthReporterMock.Verify(o => o.ReportProblem(It.IsAny <string>(), It.IsAny <string>()), Times.Never());
                }
        }