public SessionResults RunAssembly(Assembly assembly) { var sessionResults = new SessionResults(); var runner = new RunnerInvocation(assembly.Location, String.Empty, new GilesSessionResultsFormatter(sessionResults), false); var runResults = runner.Run(); return sessionResults; }
private dynamic GetRunner(SessionResults sessionResults) { dynamic dynamicRunListener = GetMSpecRunListener(sessionResults); var appDomainRunnerType = MSpecTypes.Types.First(x => x.Name == "AppDomainRunner"); return Activator.CreateInstance(appDomainRunnerType, dynamicRunListener, GetRunOptions()); }
public SessionResults RunAssembly(Assembly assembly) { var sessionResults = new SessionResults(); var logger = new GilesXunitLogger(); using (var exWrapper = new XunitFx.ExecutorWrapper(new Uri(assembly.CodeBase).LocalPath, null, false)) { var runner = new XunitFx.TestRunner(exWrapper, logger); var result = runner.RunAssembly(); } return logger.SessionResults; }
private static dynamic GetRunner(SessionResults sessionResults) { dynamic dynamicRunListener = GetMSpecRunListener(sessionResults); var runOptionsType = MSpecTypes.Types.First(x => x.Name == "RunOptions"); var runOptions = Activator.CreateInstance(runOptionsType, new string[] { }, new string[] { }, new string[] { }); var appDomainRunnerType = MSpecTypes.Types.First(x => x.Name == "AppDomainRunner"); return Activator.CreateInstance(appDomainRunnerType, dynamicRunListener, runOptions); }
public SessionResults RunAssembly(Assembly assembly, IEnumerable<string> filters) { var sessionResults = new SessionResults(); var tags = string.Empty; if (filters.Any()) tags = filters.Aggregate((working, next) => working + "," + next); var runner = new RunnerInvocation(assembly.Location, tags, new GilesSessionResultsFormatter(sessionResults), false); runner.Run(); return sessionResults; }
public SessionResults RunAssembly(Assembly assembly) { var mspecAssembly = LoadMSpec(assembly); MSpecTypes.Types = mspecAssembly.GetExportedTypes(); var sessionResults = new SessionResults(); var runner = GetRunner(sessionResults); runner.RunAssembly(assembly); return sessionResults; }
public SessionResults RunAssembly(Assembly assembly, IEnumerable<string> filters) { this.filters = filters; var mspecAssembly = LoadMSpec(assembly); MSpecTypes.Types = mspecAssembly.GetExportedTypes(); var sessionResults = new SessionResults(); var runner = GetRunner(sessionResults); runner.RunAssembly(assembly); return sessionResults; }
public static object GetAnonymousListener(SessionResults sessionResults, List<TestResult> testResults, ResultFormatterFactory resultFormatterFactory) { return new { OnAssemblyStart = ReturnVoid.Arguments<dynamic>(assembly => { }), OnAssemblyEnd = ReturnVoid.Arguments<dynamic>(assembly => { }), OnRunStart = ReturnVoid.Arguments(() => { }), OnRunEnd = ReturnVoid.Arguments(() => testResults.ForEach(x => sessionResults.TestResults.Add(x))), OnContextStart = ReturnVoid.Arguments<dynamic>(context => { string r = string.Format("\n{0}", context.FullName); sessionResults.Messages.Add(r); }), OnContextEnd = ReturnVoid.Arguments<dynamic>(context => { }), OnSpecificationStart = ReturnVoid.Arguments<Object>(specification => { }), OnSpecificationEnd = ReturnVoid.Arguments<dynamic, dynamic>((specification, result) => { var formatter = ResultFormatterFactory.GetResultFormatterFor(result: result.Status.ToString()); string formatResult = formatter.FormatResult(specification, result); sessionResults.Messages.Add(formatResult); var testResult = new TestResult { Name = specification.Name, TestRunner = "MSPEC" }; ProcessTestResult((object) result, testResult, testResults); }), OnFatalError = ReturnVoid.Arguments<dynamic>(exception => sessionResults.Messages.Add("Fatal error: " + exception)), sessionResults, testResults, resultFormatterFactory }; }
private static object GetMSpecRunListener(SessionResults sessionResults) { var specificationRunListenerType = MSpecTypes.Types.First(x => x.Name == "ISpecificationRunListener"); return Impromptu.DynamicActLike(GilesMSpecRunListener.GetAnonymousListener(sessionResults, new List<TestResult>(), new ResultFormatterFactory()), specificationRunListenerType); }
public GilesSessionResultsFormatter(SessionResults sessionResults) { _sessionResults = sessionResults; }