public void it_should_start_a_new_test_when_the_xap_file_changed()
        {
            TestEventPublisher.SendMessage(new XapFileBuildChangedServerEvent(string.Empty));

            System.Threading.Thread.Sleep(10);

            _continuousTestRunner.IsCurrentlyRunningTest.ShouldBeTrue();
            _mockWebBrowser.Verify(x => x.Start());
        }
        public void when_the_test_was_signaled_completed_the_browser_should_have_been_stopped_and_the_ContinuousTestRunner_should_signal_that_it_is_not_currently_running()
        {
            var runner = CreateContinuousTestRunner();

            TestEventPublisher.SendMessage(new TestRunCompletedServerEvent());

            runner.IsCurrentlyRunningTest.ShouldBeFalse();
            _mockWebBrowser.Verify(x => x.Stop());
        }
        private void ForceFilteredTestWithTag(string newTag)
        {
            _continuousTestRunner.ForceFilteredTest(newTag);

            _continuousTestRunner.IsCurrentlyRunningTest.ShouldBeTrue();

            TestEventPublisher.SendMessage(new TestRunCompletedServerEvent());

            _continuousTestRunner.IsCurrentlyRunningTest.ShouldBeFalse();
        }
        protected override void Before_all_tests()
        {
            _mockWebBrowser = new Mock <IWebBrowser>();

            base.Before_all_tests();

            _clientTestRunConfiguration = new ClientTestRunConfiguration(UnitTestProviderType.MSTest, new List <string>(), "", 1, WebBrowserType.SelfHosted, false, string.Empty);
            _continuousTestRunner       = new ContinuousTestRunner(TestLogger, TestEventSubscriptionManager, TestEventPublisher, _mockWebBrowser.Object, _clientTestRunConfiguration, "test");

            // Signal that the first test has already finished.
            TestEventPublisher.SendMessage(new TestRunCompletedServerEvent());
        }
        public void it_should_start_a_new_test_when_the_xap_file_changed_but_not_if_its_already_running_a_test()
        {
            // There's one Start from setup, and one from the first Changed event
            // let's make sure that the second Changed event doesn't fire a start again
            // because we are currently running a test
            _mockWebBrowser.Setup(s => s.Start()).AtMost(2);

            TestEventPublisher.SendMessage(new XapFileBuildChangedServerEvent(string.Empty));

            // quick test to verify that the test is "running"
            _continuousTestRunner.IsCurrentlyRunningTest.ShouldBeTrue();

            TestEventPublisher.SendMessage(new XapFileBuildChangedServerEvent(string.Empty));
        }
 protected override void Before_all_tests()
 {
     base.Before_all_tests();
     SetupEventToSeeIfPublished();
     TestEventPublisher.SendMessage(new TestRunCompletedServerEvent());
 }