コード例 #1
0
ファイル: NSpecRunner.cs プロジェクト: ericbock/Giles
 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;
 }
コード例 #2
0
ファイル: MSpecRunner.cs プロジェクト: michaelsync/Giles
        private dynamic GetRunner(SessionResults sessionResults)
        {
            dynamic dynamicRunListener = GetMSpecRunListener(sessionResults);

            var appDomainRunnerType = MSpecTypes.Types.First(x => x.Name == "AppDomainRunner");
            return Activator.CreateInstance(appDomainRunnerType, dynamicRunListener, GetRunOptions());
        }
コード例 #3
0
ファイル: XunitTestRunner.cs プロジェクト: Erkan-Yilmaz/Giles
 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;
 }
コード例 #4
0
ファイル: MSpecRunner.cs プロジェクト: bivvo/Giles
        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);
        }
コード例 #5
0
ファイル: NSpecRunner.cs プロジェクト: skalinets/Giles
 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;
 }
コード例 #6
0
ファイル: MSpecRunner.cs プロジェクト: bivvo/Giles
        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;
        }
コード例 #7
0
ファイル: MSpecRunner.cs プロジェクト: michaelsync/Giles
        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;
        }
コード例 #8
0
        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
                };
        }
コード例 #9
0
ファイル: MSpecRunner.cs プロジェクト: bivvo/Giles
 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);
 }
コード例 #10
0
 public GilesSessionResultsFormatter(SessionResults sessionResults)
 {
     _sessionResults = sessionResults;
 }