public IResultSummary Run(object fixture) { try { this.m_Fixture = fixture; this.m_Source = new EmbeddedResourceSource(fixture.GetType().Assembly); this.m_SpecificationConfig = new SpecificationConfig().Load(fixture.GetType()); this.m_Target = new FileTarget(m_SpecificationConfig.BaseOutputDirectory); var fileExtensions = m_SpecificationConfig.SpecificationFileExtensions; if (fileExtensions.Count > 1) { return RunAllSpecifications(fileExtensions); } else if (fileExtensions.Count == 1) { return RunSingleSpecification(fileExtensions.First()); } else { throw new InvalidOperationException(string.Format("no specification extensions defined for: {0}", this.m_SpecificationConfig)); } } catch (Exception e) { Console.WriteLine(e); var exceptionResult = new SummarizingResultRecorder(); exceptionResult.Record(Result.Exception); return exceptionResult; } }
public void Test_Can_Get_File_Path_Successfully() { var resource = new Mock<Resource>("\\blah\\blah.txt"); resource.Setup(x => x.Path).Returns("\\blah\\blah.txt"); var target = new FileTarget(@"c:\temp"); Assert.Equal<string>(@"c:\temp\blah\blah.txt", target.GetTargetPath(resource.Object)); }
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; }
public ConcordionBuilder SendOutputTo(string directory) { Target = new FileTarget(directory); return this; }
public Concordion Build() { Check.IsFalse(this.m_BuiltAlready, "ConcordionBuilder currently does not support calling build() twice"); this.m_BuiltAlready = true; WithApprovedCommand(HtmlFramework.NAMESPACE_CONCORDION_2007, "run", RunCommand); WithApprovedCommand(HtmlFramework.NAMESPACE_CONCORDION_2007, "execute", ExecuteCommand); WithApprovedCommand(HtmlFramework.NAMESPACE_CONCORDION_2007, "set", new SetCommand()); WithApprovedCommand(HtmlFramework.NAMESPACE_CONCORDION_2007, "assertEquals", AssertEqualsCommand); WithApprovedCommand(HtmlFramework.NAMESPACE_CONCORDION_2007, "assertTrue", AssertTrueCommand); WithApprovedCommand(HtmlFramework.NAMESPACE_CONCORDION_2007, "assertFalse", AssertFalseCommand); WithApprovedCommand(HtmlFramework.NAMESPACE_CONCORDION_2007, "verifyRows", VerifyRowsCommand); WithApprovedCommand(HtmlFramework.NAMESPACE_CONCORDION_2007, "echo", EchoCommand); if (Target == null) { Target = new FileTarget(BaseOutputDir ?? Directory.GetCurrentDirectory()); } SetAllRunners(); SpecificationCommand.AddSpecificationListener(new BreadCrumbRenderer(this.Source)); SpecificationCommand.AddSpecificationListener(new PageFooterRenderer(this.Target)); SpecificationCommand.AddSpecificationListener(new SpecificationRenderer(this.Target)); SpecificationReader = new XmlSpecificationReader(Source, DocumentParser); CopyResources(); AddSpecificationListeners(); foreach (var concordionBuildListener in BuildListeners) { concordionBuildListener.ConcordionBuilt(new ConcordionBuildEvent(Target)); } return new Concordion(SpecificationLocator, SpecificationReader, EvaluatorFactory); }
public Concordion Build() { if (Target == null) { Target = new FileTarget(BaseOutputDir ?? Directory.GetCurrentDirectory()); } SetAllRunners(); var breadCrumbRenderer = new BreadCrumbRenderer(Source); SpecificationCommand.SpecificationCommandProcessing += breadCrumbRenderer.SpecificationProcessingEventHandler; SpecificationCommand.SpecificationCommandProcessed += breadCrumbRenderer.SpecificationProcessedEventHandler; var pageFooterRenderer = new PageFooterRenderer(Target); SpecificationCommand.SpecificationCommandProcessing += pageFooterRenderer.SpecificationProcessingEventHandler; SpecificationCommand.SpecificationCommandProcessed += pageFooterRenderer.SpecificationProcessedEventHandler; var specificationRenderer = new SpecificationRenderer(Target); SpecificationCommand.SpecificationCommandProcessing += specificationRenderer.SpecificationProcessingEventHandler; SpecificationCommand.SpecificationCommandProcessed += specificationRenderer.SpecificationProcessedEventHandler; SpecificationReader = new XmlSpecificationReader(Source, DocumentParser); return new Concordion(SpecificationLocator, SpecificationReader, EvaluatorFactory); }