Example #1
0
        private static TestCaseData[] GetRegressionTestParameters()
        {
            TestGlobals.Initialize();

            // 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 },
                { "WarmUpAfterInitializeRegression", AlgorithmStatus.RuntimeError }
            };

            var languages = Config.GetValue("regression-test-languages", JArray.FromObject(new[] { "CSharp", "Python" }))
                            .Select(str => Parse.Enum <Language>(str.Value <string>()))
                            .ToHashSet();

            // 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(Array.Empty <Type>()) != 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.Where(languages.Contains)
                                                   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());
        }
Example #2
0
        private static TestCaseData[] GetResearchRegressionTestParameters()
        {
            TestGlobals.Initialize();

            // 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);;
        }
Example #3
0
 public void InitializeTestEnvironment()
 {
     AdjustCurrentDirectory();
     TestGlobals.Initialize();
 }
Example #4
0
 private static Symbol CreateEquitySymbol(string symbol, string market = Market.USA)
 {
     TestGlobals.Initialize();
     return(Symbol.Create(symbol, SecurityType.Equity, market));
 }
Example #5
0
 public void InitializeTestEnvironment()
 {
     TryAddIconicDataSubTypes();
     AdjustCurrentDirectory();
     TestGlobals.Initialize();
 }