コード例 #1
0
ファイル: PerfLab.cs プロジェクト: ovidiomanteiga/NPerf
        public void AddAssemblies(params Assembly[] assemblies)
        {
            var newAssemblies = (from assembly in assemblies
                                 where !loadedAssemblies.Contains(assembly)
                                 select assembly).ToArray();

            var allAssemblies = loadedAssemblies.Union(newAssemblies).Distinct().ToArray();

            var newTestSuites = (from assembly in allAssemblies
                                 from tester in assembly.TypesWith <PerfTesterAttribute>()
                                 select
                                 TestSuiteManager.GetTestSuiteInfo(tester, allAssemblies
                                                                   .SelectMany(t => t.Types())
                                                                   .Where(
                                                                       testedType =>
                                                                       IsTestableType(tester,
                                                                                      testedType)),
                                                                   this.testSuites.ToArray()));


            this.testSuites.AddRange(newTestSuites.Where(x => !testSuites.Contains(x)).ToArray());

            loadedAssemblies.AddRange(newAssemblies);
            this.tests = this.testSuites.SelectMany(suite => suite.Tests)
                         .ToDictionary(test => test.TestId, test => test);
        }
コード例 #2
0
ファイル: PerfLab.cs プロジェクト: ovidiomanteiga/NPerf
        public PerfLab(Assembly fixtureLib, params Assembly[] testSubjects)
        {
            this.SystemInfo = SystemInfo.Instance;

            this.testSuites = (from tester in fixtureLib.TypesWith <PerfTesterAttribute>()
                               select TestSuiteManager.GetTestSuiteInfo(tester, testSubjects.Distinct()
                                                                        .SelectMany(t => t.Types())
                                                                        .Where(
                                                                            testedType =>
                                                                            IsTestableType(tester,
                                                                                           testedType))))
                              .ToList();
            this.tests = this.testSuites.SelectMany(suite => suite.Tests)
                         .ToDictionary(test => test.TestId, test => test);

            loadedAssemblies.AddRange(testSubjects.Union(new[] { fixtureLib })
                                      .Distinct());
        }
コード例 #3
0
ファイル: PerfLab.cs プロジェクト: ovidiomanteiga/NPerf
        public PerfLab(params Assembly[] perfTestAssemblies)
        {
            this.SystemInfo = SystemInfo.Instance;

            this.testSuites = (from assembly in perfTestAssemblies.Distinct()
                               from tester in assembly.TypesWith <PerfTesterAttribute>()
                               select
                               TestSuiteManager.GetTestSuiteInfo(tester,
                                                                 perfTestAssemblies.SelectMany(t => t.Types())
                                                                 .Where(
                                                                     testedType =>
                                                                     IsTestableType(tester,
                                                                                    testedType))))
                              .ToList();

            this.tests = this.testSuites.SelectMany(suite => suite.Tests)
                         .ToDictionary(test => test.TestId, test => test);

            loadedAssemblies.AddRange(perfTestAssemblies.Distinct());
        }
コード例 #4
0
ファイル: PerfLab.cs プロジェクト: ovidiomanteiga/NPerf
 public IObservable <PerfTestResult> Run(int start, int step, int end, PerfTestConfiguration configuration, bool parallel = false)
 {
     return(this.testSuites.ToObservable().SelectMany(suite => TestSuiteManager.Run(suite, start, step, end, configuration, parallel)));
 }
コード例 #5
0
ファイル: PerfLab.cs プロジェクト: ovidiomanteiga/NPerf
 public IObservable <PerfTestResult> Run(Guid[] tests, int start, int step, int end, PerfTestConfiguration configuration, bool parallel = false)
 {
     return(TestSuiteManager.Run(tests.Select(x => this.Tests[x]).ToArray(), start, step, end, configuration, parallel));
 }