public void ShouldNotRemoreWordTestInBetween()
 {
     var specificationLocator = new ClassNameBasedSpecificationLocator();
     var resource = specificationLocator.LocateSpecification(new DummyContainingTestInNameTest());
     var path = resource.Path.Replace(Path.DirectorySeparatorChar, '/');
     Assert.AreEqual("Concordion/Test/Internal/DummyContainingTestInName.html", path, "path from SpecificiationLocator removed 'Test' in the middle");
 }
 public void ShouldRemoveTestSuffixes()
 {
     var specificationLocator = new ClassNameBasedSpecificationLocator();
     var resource = specificationLocator.LocateSpecification(this);
     var path = resource.Path.Replace(Path.DirectorySeparatorChar, '/');
     Assert.AreEqual("Concordion/Test/Internal/SpecificationLocator.html", path, "path from SpecificationLocator contains 'Test'");
 }
Exemplo n.º 3
0
        public ConcordionBuilder()
        {
            SpecificationLocator = new ClassNameBasedSpecificationLocator();
            Source               = null;
            Target               = null;
            CommandRegistry      = new CommandRegistry();
            DocumentParser       = new DocumentParser(CommandRegistry);
            EvaluatorFactory     = new SimpleEvaluatorFactory();
            SpecificationCommand = new SpecificationCommand();
            AssertEqualsCommand  = new AssertEqualsCommand();
            AssertTrueCommand    = new AssertTrueCommand();
            AssertFalseCommand   = new AssertFalseCommand();
            ExecuteCommand       = new ExecuteCommand();
            RunCommand           = new RunCommand();
            VerifyRowsCommand    = new VerifyRowsCommand();
            EchoCommand          = new EchoCommand();
            ExceptionRenderer    = new ExceptionRenderer();

            // Set up the commands

            CommandRegistry.Register("", "specification", SpecificationCommand);
            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);

            // Wire up the command listeners

            var assertEqualsResultRenderer = new AssertEqualsResultRenderer();

            AssertEqualsCommand.SuccessReported += assertEqualsResultRenderer.SuccessReportedEventHandler;
            AssertEqualsCommand.FailureReported += assertEqualsResultRenderer.FailureReportedEventHandler;
            AssertTrueCommand.SuccessReported   += assertEqualsResultRenderer.SuccessReportedEventHandler;
            AssertTrueCommand.FailureReported   += assertEqualsResultRenderer.FailureReportedEventHandler;
            AssertFalseCommand.SuccessReported  += assertEqualsResultRenderer.SuccessReportedEventHandler;
            AssertFalseCommand.FailureReported  += assertEqualsResultRenderer.FailureReportedEventHandler;

            var verifyRowsCommandRenderer = new VerifyRowResultRenderer();

            VerifyRowsCommand.MissingRowFound += verifyRowsCommandRenderer.MissingRowFoundEventHandler;
            VerifyRowsCommand.SurplusRowFound += verifyRowsCommandRenderer.SurplusRowFoundEventHandler;

            var runResultRenderer = new RunResultRenderer();

            RunCommand.SuccessfulRunReported += runResultRenderer.SuccessfulRunReportedEventHandler;
            RunCommand.FailedRunReported     += runResultRenderer.FailedRunReportedEventHandler;
            RunCommand.IgnoredRunReported    += runResultRenderer.IgnoredRunReportedEventHandler;

            var documentStructureImprovementRenderer = new DocumentStructureImprovementRenderer();

            DocumentParser.DocumentParsing += documentStructureImprovementRenderer.DocumentParsingEventHandler;

            var stylesheetEmbeddingRenderer = new StylesheetEmbeddingRenderer(HtmlFramework.EMBEDDED_STYLESHEET_RESOURCE);

            DocumentParser.DocumentParsing += stylesheetEmbeddingRenderer.DocumentParsingEventHandler;
        }
        public ConcordionBuilder()
        {
            SpecificationLocator = new ClassNameBasedSpecificationLocator();
            Source = null;
            Target = null;
            CommandRegistry = new CommandRegistry();
            DocumentParser = new DocumentParser(CommandRegistry);
            EvaluatorFactory = new SimpleEvaluatorFactory();
            SpecificationCommand = new SpecificationCommand();
            AssertEqualsCommand = new AssertEqualsCommand();
            AssertTrueCommand = new AssertTrueCommand();
            AssertFalseCommand = new AssertFalseCommand();
            ExecuteCommand = new ExecuteCommand();
            RunCommand = new RunCommand();
            VerifyRowsCommand = new VerifyRowsCommand();
            EchoCommand = new EchoCommand();
            ExceptionRenderer = new ExceptionRenderer();

            // Set up the commands

            CommandRegistry.Register("", "specification", SpecificationCommand);
            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);

            // Wire up the command listeners

            var assertEqualsResultRenderer = new AssertEqualsResultRenderer();
            AssertEqualsCommand.SuccessReported += assertEqualsResultRenderer.SuccessReportedEventHandler;
            AssertEqualsCommand.FailureReported += assertEqualsResultRenderer.FailureReportedEventHandler;
            AssertTrueCommand.SuccessReported += assertEqualsResultRenderer.SuccessReportedEventHandler;
            AssertTrueCommand.FailureReported += assertEqualsResultRenderer.FailureReportedEventHandler;
            AssertFalseCommand.SuccessReported += assertEqualsResultRenderer.SuccessReportedEventHandler;
            AssertFalseCommand.FailureReported += assertEqualsResultRenderer.FailureReportedEventHandler;

            var verifyRowsCommandRenderer = new VerifyRowResultRenderer();
            VerifyRowsCommand.MissingRowFound += verifyRowsCommandRenderer.MissingRowFoundEventHandler;
            VerifyRowsCommand.SurplusRowFound += verifyRowsCommandRenderer.SurplusRowFoundEventHandler;

            var runResultRenderer = new RunResultRenderer();
            RunCommand.SuccessfulRunReported += runResultRenderer.SuccessfulRunReportedEventHandler;
            RunCommand.FailedRunReported += runResultRenderer.FailedRunReportedEventHandler;
            RunCommand.IgnoredRunReported += runResultRenderer.IgnoredRunReportedEventHandler;

            var documentStructureImprovementRenderer = new DocumentStructureImprovementRenderer();
            DocumentParser.DocumentParsing += documentStructureImprovementRenderer.DocumentParsingEventHandler;

            var stylesheetEmbeddingRenderer = new StylesheetEmbeddingRenderer(HtmlFramework.EMBEDDED_STYLESHEET_RESOURCE);
            DocumentParser.DocumentParsing += stylesheetEmbeddingRenderer.DocumentParsingEventHandler;
        }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        public ConcordionBuilder()
        {
            BuildListeners = new List <IConcordionBuildListener>();
            SpecificationProcessingListeners = new List <ISpecificationProcessingListener>();
            ResourceToCopyMap  = new Dictionary <string, Resource>();
            ExceptionListeners = new List <IExceptionCaughtListener>();

            SpecificationLocator = new ClassNameBasedSpecificationLocator();
            Source               = null;
            Target               = null;
            CommandRegistry      = new CommandRegistry();
            DocumentParser       = new DocumentParser(CommandRegistry);
            EvaluatorFactory     = new SimpleEvaluatorFactory();
            SpecificationCommand = new SpecificationCommand();
            AssertEqualsCommand  = new AssertEqualsCommand();
            AssertTrueCommand    = new AssertTrueCommand();
            AssertFalseCommand   = new AssertFalseCommand();
            ExecuteCommand       = new ExecuteCommand();
            RunCommand           = new RunCommand();
            VerifyRowsCommand    = new VerifyRowsCommand();
            EchoCommand          = new EchoCommand();
            ExceptionRenderer    = new ExceptionRenderer();

            WithExceptionListener(ExceptionRenderer);

            // Set up the commands

            CommandRegistry.Register("", "specification", SpecificationCommand);

            // Wire up the command listeners

            var assertResultRenderer = new AssertResultRenderer();

            WithAssertEqualsListener(assertResultRenderer);
            WithAssertTrueListener(assertResultRenderer);
            WithAssertFalseListener(assertResultRenderer);
            WithVerifyRowsListener(new VerifyRowResultRenderer());
            WithRunListener(new RunResultRenderer());
            WithDocumentParsingListener(new DocumentStructureImprover());
            WithDocumentParsingListener(new MetadataCreator());
            WithEmbeddedCss(HtmlFramework.EMBEDDED_STYLESHEET_RESOURCE);
        }
        public ConcordionBuilder()
        {
            BuildListeners = new List<IConcordionBuildListener>();
            SpecificationProcessingListeners = new List<ISpecificationProcessingListener>();
            ResourceToCopyMap = new Dictionary<string, Resource>();
            ExceptionListeners = new List<IExceptionCaughtListener>();

            SpecificationLocator = new ClassNameBasedSpecificationLocator();
            Source = null;
            Target = null;
            CommandRegistry = new CommandRegistry();
            DocumentParser = new DocumentParser(CommandRegistry);
            EvaluatorFactory = new SimpleEvaluatorFactory();
            SpecificationCommand = new SpecificationCommand();
            AssertEqualsCommand = new AssertEqualsCommand();
            AssertTrueCommand = new AssertTrueCommand();
            AssertFalseCommand = new AssertFalseCommand();
            ExecuteCommand = new ExecuteCommand();
            RunCommand = new RunCommand();
            VerifyRowsCommand = new VerifyRowsCommand();
            EchoCommand = new EchoCommand();
            ExceptionRenderer = new ExceptionRenderer();

            WithExceptionListener(ExceptionRenderer);

            // Set up the commands

            CommandRegistry.Register("", "specification", SpecificationCommand);

            // Wire up the command listeners

            var assertResultRenderer = new AssertResultRenderer();
            WithAssertEqualsListener(assertResultRenderer);
            WithAssertTrueListener(assertResultRenderer);
            WithAssertFalseListener(assertResultRenderer);
            WithVerifyRowsListener(new VerifyRowResultRenderer());
            WithRunListener(new RunResultRenderer());
            WithDocumentParsingListener(new DocumentStructureImprover());
            WithDocumentParsingListener(new MetadataCreator());
            WithEmbeddedCss(HtmlFramework.EMBEDDED_STYLESHEET_RESOURCE);
        }
Exemplo n.º 8
0
 private IResultSummary RunAllSpecifications(IEnumerable<string> fileExtensions)
 {
     var testSummary = new SummarizingResultRecorder();
     var anySpecExecuted = false;
     foreach (var fileExtension in fileExtensions)
     {
         var specLocator = new ClassNameBasedSpecificationLocator(fileExtension);
         var specResource = specLocator.LocateSpecification(m_Fixture);
         if (m_Source.CanFind(specResource))
         {
             var fixtureResult = RunSingleSpecification(fileExtension);
             AddToTestResults(fixtureResult, testSummary);
             anySpecExecuted = true;
         }
     }
     if (!anySpecExecuted)
     {
         testSummary.Record(Result.Exception);
         Console.WriteLine("no active specification found for fixture: {0}", m_Fixture.GetType().FullName);
     }
     return testSummary;
 }
Exemplo n.º 9
0
        private IResultSummary RunAllSpecifications(IEnumerable <string> fileExtensions)
        {
            var testSummary     = new SummarizingResultRecorder();
            var anySpecExecuted = false;

            foreach (var fileExtension in fileExtensions)
            {
                var specLocator  = new ClassNameBasedSpecificationLocator(fileExtension);
                var specResource = specLocator.LocateSpecification(m_Fixture);
                if (m_Source.CanFind(specResource))
                {
                    var fixtureResult = RunSingleSpecification(fileExtension);
                    AddToTestResults(fixtureResult, testSummary);
                    anySpecExecuted = true;
                }
            }
            if (!anySpecExecuted)
            {
                string specPath;
                if (!string.IsNullOrEmpty(m_SpecificationConfig.BaseInputDirectory))
                {
                    specPath = string.Format("directory {0}",
                                             Path.GetFullPath(m_SpecificationConfig.BaseInputDirectory));
                }
                else
                {
                    specPath = string.Format("assembly {0}",
                                             m_Fixture.GetType().Assembly.GetName().Name);
                }
                testSummary.Error(new AssertionErrorException(string.Format(
                                                                  "no active specification found for {0} in {1}",
                                                                  this.m_Fixture.GetType().Name,
                                                                  specPath)));
            }
            return(testSummary);
        }
Exemplo n.º 10
0
 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);
 }
Exemplo n.º 11
0
 private IResultSummary RunAllSpecifications(IEnumerable<string> fileExtensions)
 {
     var testSummary = new SummarizingResultRecorder();
     var anySpecExecuted = false;
     foreach (var fileExtension in fileExtensions)
     {
         var specLocator = new ClassNameBasedSpecificationLocator(fileExtension);
         var specResource = specLocator.LocateSpecification(m_Fixture);
         if (m_Source.CanFind(specResource))
         {
             var fixtureResult = RunSingleSpecification(fileExtension);
             AddToTestResults(fixtureResult, testSummary);
             anySpecExecuted = true;
         }
     }
     if (!anySpecExecuted)
     {
         string specPath;
         if (!string.IsNullOrEmpty(m_SpecificationConfig.BaseInputDirectory))
         {
             specPath = string.Format("directory {0}",
                 Path.GetFullPath(m_SpecificationConfig.BaseInputDirectory));
         }
         else
         {
             specPath = string.Format("assembly {0}",
                 m_Fixture.GetType().Assembly.GetName().Name);
         }
         testSummary.Error(new AssertionErrorException(string.Format(
             "no active specification found for {0} in {1}",
             this.m_Fixture.GetType().Name,
             specPath)));
     }
     return testSummary;
 }