示例#1
0
        NSpecExampleTest CreateGallioTestFrom(Example nspecExample)
        {
            try
            {
                NSpecExampleTest exampleTest = new NSpecExampleTest(nspecExample);

                return exampleTest;
            }
            catch
            {
                throw new Exception(String.Format("Error adding example {0}", nspecExample.Spec));
            }
        }
示例#2
0
        TestResult RunTest( NSpecContextTest contextTest, NSpecExampleTest exampleTest, 
            ITestCommand testCommand, TestStep testStep )
        {
            ITestContext testContext = testCommand.StartPrimaryChildStep( testStep );
            TestOutcome outcome = TestOutcome.Passed;

            if( exampleTest.Example.Pending )
            {
                outcome = TestOutcome.Pending;
                testContext.AddMetadata( MetadataKeys.PendingReason, "Needs to be implemented" );
            }
            else
            {
                contextTest.Context.Exercise(exampleTest.Example,contextTest.Context.GetInstance());

                if( exampleTest.Example.Exception != null )
                {
                    TestLog.Failures.WriteException( ConvertException( exampleTest.Example.Exception ) );
                    TestLog.Failures.Flush();

                    outcome = TestOutcome.Failed;
                }
            }

            return testContext.FinishStep( outcome, null );
        }