コード例 #1
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);
        }