internal ExecutionSummary Run(IReadOnlyList <Type> candidateTypes, Discovery discovery, Execution execution) { bus.Publish(new AssemblyStarted(assembly)); var assemblySummary = new ExecutionSummary(); var stopwatch = Stopwatch.StartNew(); var classDiscoverer = new ClassDiscoverer(discovery); var classRunner = new ClassRunner(bus, discovery, execution); var testClasses = classDiscoverer.TestClasses(candidateTypes); bool isOnlyTestClass = testClasses.Count == 1; foreach (var testClass in testClasses) { var classSummary = classRunner.Run(testClass, isOnlyTestClass); assemblySummary.Add(classSummary); } stopwatch.Stop(); bus.Publish(new AssemblyCompleted(assembly, assemblySummary, stopwatch.Elapsed)); return(assemblySummary); }
public IReadOnlyList <MethodGroup> DiscoverTestMethodGroups(Assembly assembly) { RunContext.Set(options); var conventions = new ConventionDiscoverer(assembly).GetConventions(); var discoveredTestMethodGroups = new List <MethodGroup>(); foreach (var convention in conventions) { var classDiscoverer = new ClassDiscoverer(convention); var candidateTypes = assembly.GetTypes(); var testClasses = classDiscoverer.TestClasses(candidateTypes); var methodDiscoverer = new MethodDiscoverer(convention); foreach (var testClass in testClasses) { var distinctMethodGroups = new Dictionary <string, MethodGroup>(); foreach (var testMethod in methodDiscoverer.TestMethods(testClass)) { var methodGroup = new MethodGroup(testMethod); distinctMethodGroups[methodGroup.FullName] = methodGroup; } discoveredTestMethodGroups.AddRange(distinctMethodGroups.Values); } } return(discoveredTestMethodGroups); }
public IReadOnlyList<MethodGroup> DiscoverTestMethodGroups(Assembly assembly) { RunContext.Set(options); var conventions = new ConventionDiscoverer(assembly).GetConventions(); var discoveredTestMethodGroups = new List<MethodGroup>(); foreach (var convention in conventions) { var classDiscoverer = new ClassDiscoverer(convention); var candidateTypes = assembly.GetTypes(); var testClasses = classDiscoverer.TestClasses(candidateTypes); var methodDiscoverer = new MethodDiscoverer(convention); foreach (var testClass in testClasses) { var distinctMethodGroups = new Dictionary<string, MethodGroup>(); foreach (var testMethod in methodDiscoverer.TestMethods(testClass)) { var methodGroup = new MethodGroup(testMethod); distinctMethodGroups[methodGroup.FullName] = methodGroup; } discoveredTestMethodGroups.AddRange(distinctMethodGroups.Values); } } return discoveredTestMethodGroups; }
void Run(Discovery discovery, Execution execution, Type[] candidateTypes, ExecutionSummary assemblySummary) { var classDiscoverer = new ClassDiscoverer(discovery); var classRunner = new ClassRunner(bus, discovery, execution); var testClasses = classDiscoverer.TestClasses(candidateTypes); bool isOnlyTestClass = testClasses.Count == 1; foreach (var testClass in testClasses) { var classSummary = classRunner.Run(testClass, isOnlyTestClass); assemblySummary.Add(classSummary); } }
ConventionResult Run(Convention convention, Type[] candidateTypes) { var classDiscoverer = new ClassDiscoverer(convention.Config); var conventionResult = new ConventionResult(convention.GetType().FullName); var classRunner = new ClassRunner(listener, convention.Config); foreach (var testClass in classDiscoverer.TestClasses(candidateTypes)) { var classResult = classRunner.Run(testClass); conventionResult.Add(classResult); } return(conventionResult); }
public void DiscoverMethods(Assembly assembly) { var discovery = new BehaviorDiscoverer(assembly, customArguments).GetDiscovery(); try { var classDiscoverer = new ClassDiscoverer(discovery); var candidateTypes = assembly.GetTypes(); var testClasses = classDiscoverer.TestClasses(candidateTypes); var methodDiscoverer = new MethodDiscoverer(discovery); foreach (var testClass in testClasses) { foreach (var testMethod in methodDiscoverer.TestMethods(testClass)) { bus.Publish(new MethodDiscovered(testMethod)); } } } finally { discovery.Dispose(); } }
ConventionResult Run(Convention convention, Type[] candidateTypes) { var classDiscoverer = new ClassDiscoverer(convention.Config); var conventionResult = new ConventionResult(convention.GetType().FullName); var classRunner = new ClassRunner(listener, convention.Config); foreach (var testClass in classDiscoverer.TestClasses(candidateTypes)) { var classResult = classRunner.Run(testClass); conventionResult.Add(classResult); } return conventionResult; }