Beispiel #1
0
        public ProcessingResult Process(Resource resource)
        {
            var eventRecorder = new EventRecorder();
            this.Target = new StubTarget();

            var concordionBuilder = new ConcordionBuilder()
                .WithEvaluatorFactory(this.EvaluatorFactory)
                .WithSource(this.Source)
                .WithTarget(this.Target)
                .WithAssertEqualsListener(eventRecorder)
                .WithExceptionListener(eventRecorder);

            if (this.Fixture != null)
            {
                new ExtensionLoader(this.Configuration).AddExtensions(this.Fixture, concordionBuilder);
            }

            if (this.Extension != null)
            {
                this.Extension.AddTo(concordionBuilder);
            }

            var concordion = concordionBuilder.Build();

            try
            {
                IResultSummary resultSummary = concordion.Process(resource, this.Fixture);
                string xml = this.Target.GetWrittenString(resource);
                return new ProcessingResult(resultSummary, eventRecorder, xml);
            }
            catch (Exception e)
            {
                throw new Exception("Test rig failed to process specification", e);
            }
        }
        public override TestResult Run(EventListener listener, ITestFilter filter)
        {
            listener.TestStarted(TestName);

            var source = new EmbeddedResourceSource(m_FixtureType.Assembly);
            var target = new FileTarget(new SpecificationConfig().Load(m_FixtureType).BaseOutputDirectory);
            var concordion = new ConcordionBuilder().WithSource(source).WithTarget(target).Build();

            Fixture = Reflect.Construct(m_FixtureType);
            var concordionResult = concordion.Process(Fixture);
            var testResult = NUnitTestResult(concordionResult);

            listener.TestFinished(testResult);

            return testResult;
        }
        private IResultSummary RunSingleSpecification(string fileExtension)
        {
            var specificationLocator = new ClassNameBasedSpecificationLocator(fileExtension);

            ResultPath = m_Target.ResolvedPathFor(specificationLocator.LocateSpecification(m_Fixture));
            var concordionExtender = new ConcordionBuilder();

            concordionExtender
            .WithSource(m_Source)
            .WithTarget(m_Target)
            .WithSpecificationLocator(specificationLocator);
            var extensionLoader = new ExtensionLoader(m_SpecificationConfig);

            extensionLoader.AddExtensions(m_Fixture, concordionExtender);
            var concordion = concordionExtender.Build();

            return(concordion.Process(m_Fixture));
        }
 private static TestResult RunTestFixture(ITestCommand testCommand, ConcordionTest concordionTest, TestStep parentTestStep)
 {
    ITestContext testContext = testCommand.StartPrimaryChildStep(parentTestStep);
     
     // The magic happens here!
     var concordion = new ConcordionBuilder()
                             .WithSource(concordionTest.Source)
                             .WithTarget(concordionTest.Target)
                             .WithSpecificationListener(new GallioResultRenderer())
                             .Build();
     concordionTest.ProcessGroupStart();
     ConstructorInfo constructor = concordionTest.FixtureType.GetConstructor(Type.EmptyTypes);
     var fixture=constructor.Invoke(new object[]{});
     var summary = concordion.Process(concordionTest.Resource, fixture);
     bool passed = !(summary.HasFailures || summary.HasExceptions);
     concordionTest.ProcessGroupEnd();
     testContext.AddAssertCount((int)summary.SuccessCount + (int)summary.FailureCount);
     return testContext.FinishStep(passed ? TestOutcome.Passed : TestOutcome.Failed, null);
 }
        public ProcessingResult Process(Resource resource)
        {
            var eventRecorder = new EventRecorder();
            var stubTarget = new StubTarget();

            var concordion = new ConcordionBuilder()
                .WithAssertEqualsListener(eventRecorder)
                .WithExceptionListener(eventRecorder)
                .WithSource(Source)
                .WithEvaluatorFactory(EvaluatorFactory)
                .WithTarget(stubTarget)
                .Build();

            try
            {
                IResultSummary resultSummary = concordion.Process(resource, Fixture);
                string xml = stubTarget.GetWrittenString(resource);
                return new ProcessingResult(resultSummary, eventRecorder, xml);
            }
            catch (Exception e)
            {
                throw new Exception("Test rig failed to process specification", e);
            }
        }
 private IResultSummary RunSingleSpecification(string fileExtension)
 {
     var specificationLocator = new ClassNameBasedSpecificationLocator(fileExtension);
     ResultPath = m_Target.ResolvedPathFor(specificationLocator.LocateSpecification(m_Fixture));
     var concordionExtender = new ConcordionBuilder();
     concordionExtender
         .WithSource(m_Source)
         .WithTarget(m_Target)
         .WithSpecificationLocator(specificationLocator);
     var extensionLoader = new ExtensionLoader(m_SpecificationConfig);
     extensionLoader.AddExtensions(m_Fixture, concordionExtender);
     var concordion = concordionExtender.Build();
     return concordion.Process(m_Fixture);
 }