예제 #1
0
 public void SetResult_ThrowsIfSetTwice()
 {
     var testRun = new TestRun(null);
     var result = new TestEngineResult();
     testRun.SetResult(result);
     Assert.Throws<InvalidOperationException>(() => testRun.SetResult(result));
 }
예제 #2
0
        public void SetResult_ThrowsIfSetTwice()
        {
            var testRun = new TestRun(null);
            var result  = new TestEngineResult();

            testRun.SetResult(result);
            Assert.Throws <InvalidOperationException>(() => testRun.SetResult(result));
        }
예제 #3
0
 public void IsComplete_TrueIfComplete()
 {
     var testRun = new TestRun(null);
     var result = new TestEngineResult();
     testRun.SetResult(result);
     Assert.IsTrue(testRun.IsComplete);
 }
예제 #4
0
        public void IsComplete_TrueIfComplete()
        {
            var testRun = new TestRun(null);
            var result  = new TestEngineResult();

            testRun.SetResult(result);
            Assert.IsTrue(testRun.IsComplete);
        }
예제 #5
0
        public void Wait_AllowsMultipleWaits()
        {
            var testRun = new TestRun(null);
            testRun.SetResult(new TestEngineResult());
            
            Assert.IsTrue(testRun.Wait(TimeSpan.FromMilliseconds(0)),
                "Expected wait to be true because the test is complete");

            Assert.IsTrue(testRun.Wait(TimeSpan.FromMilliseconds(0)),
                "Expected the second wait to be non blocking");
        }
예제 #6
0
        public void Wait_AllowsMultipleWaits()
        {
            var testRun = new TestRun(null);

            testRun.SetResult(new TestEngineResult());

            Assert.IsTrue(testRun.Wait(TimeSpan.FromMilliseconds(0)),
                          "Expected wait to be true because the test is complete");

            Assert.IsTrue(testRun.Wait(TimeSpan.FromMilliseconds(0)),
                          "Expected the second wait to be non blocking");
        }
예제 #7
0
        public void Wait_ReturnsFalseTillTestCompletes()
        {
            var testRun = new TestRun(null);
            var result  = new TestEngineResult("<test-assembly />");

            Assert.IsFalse(testRun.Wait(TimeSpan.FromMilliseconds(0)),
                           "Expected wait to be false because test hasn't completed yet");

            testRun.SetResult(result);

            Assert.IsTrue(testRun.Wait(TimeSpan.FromMilliseconds(0)),
                          "Expected wait to be true because the test is complete");

            Assert.AreEqual(result.Xml, testRun.Result);
        }
예제 #8
0
        public void Wait_ReturnsFalseTillTestCompletes()
        {
            var testRun = new TestRun(null);
            var result = new TestEngineResult("<test-assembly />");

            Assert.IsFalse(testRun.Wait(TimeSpan.FromMilliseconds(0)),
                "Expected wait to be false because test hasn't completed yet");

            testRun.SetResult(result);

            Assert.IsTrue(testRun.Wait(TimeSpan.FromMilliseconds(0)),
                "Expected wait to be true because the test is complete");

            Assert.AreEqual(result.Xml, testRun.Result);
        }
예제 #9
0
        /// <summary>
        /// Start a run of the tests in the loaded TestPackage, returning immediately.
        /// The tests are run asynchronously and the listener interface is notified
        /// as it progresses.
        /// </summary>
        /// <param name="listener">An ITestEventHandler to receive events</param>
        /// <param name="filter">A TestFilter used to select tests</param>
        /// <returns>An <see cref="ITestRun"/> that will provide the result of the test execution</returns>
        protected virtual ITestRun RunTestsAsync(ITestEventListener listener, TestFilter filter)
        {
            var testRun = new TestRun(this);

            using (var worker = new BackgroundWorker())
            {
                worker.DoWork += (s, ea) =>
                {
                    var result = RunTests(listener, filter);
                    testRun.SetResult(result);
                };
                worker.RunWorkerAsync();
            }

            return(testRun);
        }
예제 #10
0
        /// <summary>
        /// Start a run of the tests in the loaded TestPackage, returning immediately.
        /// The tests are run asynchronously and the listener interface is notified 
        /// as it progresses.
        /// </summary>
        /// <param name="listener">An ITestEventHandler to receive events</param>
        /// <param name="filter">A TestFilter used to select tests</param>
        /// <returns>An <see cref="ITestRun"/> that will provide the result of the test execution</returns>
        protected virtual ITestRun RunTestsAsync(ITestEventListener listener, TestFilter filter)
        {
            var testRun = new TestRun(this);

            using (var worker = new BackgroundWorker())
            {
                worker.DoWork += (s, ea) =>
                {
                    var result = RunTests(listener, filter);
                    testRun.SetResult(result);
                };
                worker.RunWorkerAsync();
            }

            return testRun;
        }
예제 #11
0
        public void SetResult_ThrowsIfNull()
        {
            var testRun = new TestRun(null);

            Assert.Throws <ArgumentNullException>(() => testRun.SetResult(null));
        }
예제 #12
0
 public void SetResult_ThrowsIfNull()
 {
     var testRun = new TestRun(null);
     Assert.Throws<ArgumentNullException>(() => testRun.SetResult(null));
 }