public void Should_Close_Window_After_Sending_Message()
            {
                bool called = false;

                // Given
                var provider = new FakeProviderService();
                provider.RegisterProvider(typeof(FakeProvider));
                provider.RegisterConfiguration(typeof(FakeProvider), new FakeConfiguration(true));
                provider.RegisterListener(typeof(FakeProvider), new Mock<ITailStreamListener>().Object);
                provider.RegisterContext(typeof(FakeProvider), new Mock<ITailStreamContext>().Object);

                var eventAggregator = new Mock<IEventAggregator>();
                eventAggregator.Setup(x => x.Publish(It.IsAny<StartListeningEvent>()))
                    .Callback(() => called = true);

                var viewModel = new StreamConfigurationViewModel(provider, eventAggregator.Object);
                viewModel.SelectedProvider = new TailProviderInfo("Provider", typeof(FakeProvider));

                // When
                viewModel.OpenStream();

                // Then
                Assert.True(called);
                Assert.False(viewModel.IsActive);
            }
            public void Should_Not_Open_Stream_If_View_Model_Is_Invalid()
            {
                bool called = false;

                // Given
                var provider = new FakeProviderService();
                provider.RegisterProvider(typeof(FakeProvider));
                provider.RegisterConfiguration(typeof(FakeProvider), new FakeConfiguration(false));
                provider.RegisterContext(typeof(FakeProvider), new Mock<ITailStreamContext>().Object);

                var eventAggregator = new Mock<IEventAggregator>();
                eventAggregator.Setup(x => x.Publish(It.IsAny<StartListeningEvent>()))
                    .Callback(() => called = true);

                var viewModel = new StreamConfigurationViewModel(provider, eventAggregator.Object);
                viewModel.SelectedProvider = new TailProviderInfo("Provider", typeof(FakeProvider));

                // When
                viewModel.OpenStream();

                // Then
                Assert.False(called);
            }
            public void Should_Not_Open_Stream_If_No_Provider_Is_Selected()
            {
                bool called = false;

                // Given
                var provider = new FakeProviderService();

                var eventAggregator = new Mock<IEventAggregator>();
                eventAggregator.Setup(x => x.Publish(It.IsAny<StartListeningEvent>()))
                    .Callback(() => called = true);

                var viewModel = new StreamConfigurationViewModel(provider, eventAggregator.Object);
                viewModel.SelectedProvider = null;

                // When
                viewModel.OpenStream();

                // Then
                Assert.False(called);
            }