public ResultSummary Run(object fixture, SpecificationConfig specificationConfig)
        {
            var source = string.IsNullOrEmpty(specificationConfig.BaseInputDirectory)
                ? (Source)new EmbeddedResourceSource(fixture.GetType().Assembly)
                : new FileSource(fixture.GetType().Assembly, specificationConfig.BaseInputDirectory);

            var target = new FileTarget(specificationConfig.BaseOutputDirectory);

            var testSummary = new SummarizingResultRecorder();
            var anySpecExecuted = false;

            var fileExtensions = specificationConfig.SpecificationFileExtensions;
            foreach (var fileExtension in fileExtensions)
            {
                var specLocator = new ClassNameBasedSpecificationLocator(fileExtension);
                var specResource = specLocator.locateSpecification(fixture);
                if (source.canFind(specResource))
                {
                    var fixtureResult = RunSingleSpecification(fixture, source, specLocator, target, specificationConfig);
                    AddToTestResults(fixtureResult, testSummary);
                    anySpecExecuted = true;
                }
            }
            if (anySpecExecuted) return testSummary;

            throw new InvalidOperationException(string.Format("no specification extensions defined for: {0}", specificationConfig));
        }
Beispiel #2
0
        public ResultSummary Run(object fixture, SpecificationConfig specificationConfig)
        {
            var source = string.IsNullOrEmpty(specificationConfig.BaseInputDirectory)
                ? (Source) new EmbeddedResourceSource(fixture.GetType().Assembly)
                : new FileSource(fixture.GetType().Assembly, specificationConfig.BaseInputDirectory);

            var target = new FileTarget(specificationConfig.BaseOutputDirectory);

            var testSummary     = new SummarizingResultRecorder();
            var anySpecExecuted = false;

            var fileExtensions = specificationConfig.SpecificationFileExtensions;

            foreach (var fileExtension in fileExtensions)
            {
                var specLocator  = new ClassNameBasedSpecificationLocator(fileExtension);
                var specResource = specLocator.locateSpecification(fixture);
                if (source.canFind(specResource))
                {
                    var fixtureResult = RunSingleSpecification(fixture, source, specLocator, target, specificationConfig);
                    AddToTestResults(fixtureResult, testSummary);
                    anySpecExecuted = true;
                }
            }
            if (anySpecExecuted)
            {
                return(testSummary);
            }

            throw new InvalidOperationException(string.Format("no specification extensions defined for: {0}", specificationConfig));
        }
        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'");
        }