コード例 #1
0
        private static TestCaseData[] GetRegressionTestParameters()
        {
            // since these are static test cases, they are executed before test setup
            AssemblyInitialize.AdjustCurrentDirectory();

            var nonDefaultStatuses = new Dictionary <string, AlgorithmStatus>
            {
                { "TrainingInitializeRegressionAlgorithm", AlgorithmStatus.RuntimeError },
                { "OnOrderEventExceptionRegression", AlgorithmStatus.RuntimeError },
                { "WarmUpAfterIntializeRegression", AlgorithmStatus.RuntimeError }
            };

            // find all regression algorithms in Algorithm.CSharp
            return((
                       from type in typeof(BasicTemplateAlgorithm).Assembly.GetTypes()
                       where typeof(IRegressionAlgorithmDefinition).IsAssignableFrom(type)
                       where !type.IsAbstract                         // non-abstract
                       where type.GetConstructor(new Type[0]) != null // has default ctor
                       let instance = (IRegressionAlgorithmDefinition)Activator.CreateInstance(type)
                                      let status = nonDefaultStatuses.GetValueOrDefault(type.Name, AlgorithmStatus.Completed)
                                                   where instance.CanRunLocally // open source has data to run this algorithm
                                                   from language in instance.Languages
                                                   select new AlgorithmStatisticsTestParameters(type.Name, instance.ExpectedStatistics, language, status)
                       )
                   .OrderBy(x => x.Language).ThenBy(x => x.Algorithm)
                   // generate test cases from test parameters
                   .Select(x => new TestCaseData(x).SetName(x.Language + "/" + x.Algorithm))
                   .ToArray());
        }
コード例 #2
0
        private static TestCaseData[] GetResearchRegressionTestParameters()
        {
            // since these are static test cases, they are executed before test setup
            AssemblyInitialize.AdjustCurrentDirectory();
            var result = GetResearchTemplates()
                         .OrderBy(x => x.NotebookName)
                         // generate test cases from test parameters
                         .Select(x => new TestCaseData(x).SetName(x.NotebookName))
                         .ToArray();

            return(result);;
        }