public override TestResult RunTest()
        {
            ArrayUtil.Add(ref setUpMethods, setUpMethod);
            ArrayUtil.Add(ref tearDownMethods, tearDownMethod); // TearDown methods are run in reverse order

            using (var runner = new Runner(Spec))
            {
                var exampleResult   = new TestResult(this);
                var exampleReporter = new TestResultExampleReporter(exampleResult);

                TestResult testResult = null;
                var        example    = runner.Run(() => testResult = RunBaseTest(), exampleReporter);
                if (testResult.IsSuccess)
                {
                    if (example.IsFail)
                    {
                        testResult.Failure(GetTestResultMessageForResultState(exampleResult, ResultState.Failure, "Failing"), "");
                    }

                    if (example.IsPending)
                    {
                        testResult.Ignore(GetTestResultMessageForResultState(exampleResult, ResultState.Ignored, "Pending"));
                    }
                }
                return(testResult);
            }
        }
Beispiel #2
0
        public override TestResult RunTest()
        {
            ArrayUtil.Add(ref setUpMethods, setUpMethod);
            ArrayUtil.Add(ref tearDownMethods, tearDownMethod); // TearDown methods are run in reverse order

            using (var runner = new Runner(Spec))
            {
                var exampleResult = new TestResult(this);
                var exampleReporter = new TestResultExampleReporter(exampleResult);

                TestResult testResult = null;
                var example = runner.Run(() => testResult = RunBaseTest(), exampleReporter);
                if (testResult.IsSuccess)
                {
                    if (example.IsFail)
                        testResult.Failure(GetTestResultMessageForResultState(exampleResult, ResultState.Failure, "Failing"), "");

                    if (example.IsPending)
                        testResult.Ignore(GetTestResultMessageForResultState(exampleResult, ResultState.Ignored, "Pending"));

                }
                return testResult;
            }
        }