コード例 #1
0
        private static ExitCode RunAssembly(Assembly assembly, RunOptions runOptions)
        {
            ISpecificationRunListener listener = new BufferedAssemblyTeamCityReporter(WriteToTeamCity);

            ISpecificationRunner specificationRunner = new AppDomainRunner(listener, runOptions);

            specificationRunner.RunAssembly(assembly);

            if (listener is ISpecificationResultProvider)
            {
                var errorProvider = (ISpecificationResultProvider)listener;
                if (errorProvider.FailureOccurred)
                {
                    return(ExitCode.Failure);
                }
            }

            return(ExitCode.Success);
        }
コード例 #2
0
 // We need to buffer all output unfortunately, because unlike in the serial execution
 // scenario we can end up in a sitution where whilst we are writing to the console another
 // thread is also and the output gets interwinded. (For example happens with Fluent Migrator)
 //
 private static void WriteToTeamCity(BufferedAssemblyTeamCityReporter reporter)
 {
     lock (_outputLockObject) {
         _outputBuffer.Append(reporter.Buffer);
     }
 }