public void Run(Assembly assembly, IEnumerable<Context> contexts)
{
var hasExecutableSpecifications = contexts.Any(x => x.HasExecutableSpecifications);
var explorer = new AssemblyExplorer();
var globalCleanups = explorer.FindAssemblyWideContextCleanupsIn(assembly).ToList();
var specificationSupplements = explorer.FindSpecificationSupplementsIn(assembly).ToList();
try
{
if (hasExecutableSpecifications)
{
_assemblyStart(assembly);
}
foreach (var context in contexts)
{
RunContext(context, globalCleanups, specificationSupplements);
}
}
catch (Exception err)
{
_listener.OnFatalError(new ExceptionResult(err));
}
finally
{
if (hasExecutableSpecifications)
{
_assemblyEnd(assembly);
}
}
}