Esempio n. 1
0
        public void ValuesArePassedToExecutorWrapper()
        {
            TestableTestRunner runner = TestableTestRunner.CreateForAssembly();

            runner.RunClass("foo");

            Assert.Equal("foo", runner.Executor.RunClass_Type);
        }
Esempio n. 2
0
        public void NullAssemblyReturnsNoTests()
        {
            TestableTestRunner runner = TestableTestRunner.CreateForAssembly(null);

            TestRunnerResult result = runner.RunAssembly();

            Assert.Equal(TestRunnerResult.NoTests, result);
        }
Esempio n. 3
0
        public void EmptyAssemblyNodeReturnsNoTests()
        {
            const string       xml    = @"<assembly name='C:\foo\bar.dll' run-date='2008-09-20' run-time='12:34:56' time='0.000' total='0' passed='0' failed='0' skipped='0'/>";
            TestableTestRunner runner = TestableTestRunner.CreateForAssembly(xml);

            TestRunnerResult result = runner.RunAssembly();

            Assert.Equal(TestRunnerResult.NoTests, result);
        }
Esempio n. 4
0
        public void ValuesArePassedToExecutorWrapper()
        {
            TestableTestRunner runner = TestableTestRunner.CreateForAssembly();

            runner.RunTest("foo", "bar");

            Assert.Equal("foo", runner.Executor.RunTest_Type);
            Assert.Equal("bar", runner.Executor.RunTest_Method);
        }
Esempio n. 5
0
        public void CallsTransformerWhenAssemblyIsFinished()
        {
            TestableTestRunner runner      = TestableTestRunner.CreateForAssembly();
            StubTransformer    transformer = new StubTransformer();

            runner.RunAssembly(new IResultXmlTransform[] { transformer });

            Assert.True(transformer.Transform__Called);
            Assert.Equal(runner.Executor.RunAssembly__Result.OuterXml, transformer.Transform_Xml);
        }
Esempio n. 6
0
        public void CallsAssemblyStart()
        {
            var runner = TestableTestRunner.CreateForAssembly();

            runner.RunAssembly();

            runner.Logger.Verify(l => l.AssemblyStart(runner.Executor.AssemblyFilename,
                                                      runner.Executor.ConfigFilename,
                                                      runner.Executor.XunitVersion));
        }
Esempio n. 7
0
        public void ThrownExceptionSentToLoggerAndFailedIsReturned()
        {
            TestableTestRunner runner    = TestableTestRunner.CreateForAssembly();
            Exception          exception = new InvalidOperationException();

            runner.Executor.RunTests__CallbackEvent += delegate { throw exception; };

            TestRunnerResult result = runner.RunTests(null, null);

            runner.Logger.Verify(l => l.ExceptionThrown(@"C:\foo\bar.dll", exception));
            Assert.Equal(TestRunnerResult.Failed, result);
        }
Esempio n. 8
0
        public void ValuesArePassedToExecutorWrapper()
        {
            TestableTestRunner runner   = TestableTestRunner.CreateForAssembly();
            List <string>      testList = new List <string> {
                "bar", "baz"
            };

            runner.RunTests("foo", testList);

            Assert.Equal("foo", runner.Executor.RunTests_Type);
            Assert.Equal(testList, runner.Executor.RunTests_Methods);
        }
Esempio n. 9
0
        public void PassingAssemblyReturnsPassed()
        {
            const string       xml    = @"
<assembly name='C:\foo\bar.dll' run-date='2008-09-20' run-time='12:34:56' time='0.000' total='1' passed='1' failed='0' skipped='0'>
    <class time='1.234' name='ThisIsTheType' total='1' passed='1' failed='0' skipped='0'>
        <test name='This is the test name' type='ThisIsTheType' method='ThisIsTheMethod' result='Pass' time='1.234' />
    </class>
</assembly>";
            TestableTestRunner runner = TestableTestRunner.CreateForAssembly(xml);

            TestRunnerResult result = runner.RunAssembly();

            Assert.Equal(TestRunnerResult.Passed, result);
        }
Esempio n. 10
0
        public void FailingAssemblyReturnsFailed()
        {
            const string       xml    = @"
<assembly name='C:\foo\bar.dll' run-date='2008-09-20' run-time='12:34:56' time='0.000' total='1' passed='0' failed='1' skipped='0'>
    <class time='1.234' name='ThisIsTheType' total='1' passed='0' failed='1' skipped='0'>
        <test name='This is the test name' type='ThisIsTheType' method='ThisIsTheMethod' result='Fail' time='1.234'>
            <failure exception-type='Exception.Type'>
                <message><![CDATA[Failure message]]></message>
                <stack-trace><![CDATA[Stack trace]]></stack-trace>
            </failure>
        </test>
    </class>
</assembly>";
            TestableTestRunner runner = TestableTestRunner.CreateForAssembly(xml);

            TestRunnerResult result = runner.RunAssembly();

            Assert.Equal(TestRunnerResult.Failed, result);
        }