public void TestStrategyScan() { IStrategyAssemblyMgr strategyMgr = GetStrategyMgr(); IList <IStrategyAssembly> assemblies = strategyMgr.GetAllStrategyAssemblies(); Assert.AreEqual(2, assemblies.Count); string assemblyName = "com.wer.sc.plugin.mock.strategy.20170115"; IStrategyAssembly assembly1 = strategyMgr.GetStrategyAssembly(assemblyName); Assert.AreEqual(GetStrategyPath() + assemblyName + ".dll", assembly1.FullPath); Assert.AreEqual(assemblyName, assembly1.AssemblyName); Assert.AreEqual(4, assembly1.GetAllStrategies().Count); }
public void AddSubNodesByAssembly(TreeNode treeNode, IStrategyAssembly ass) { List <IStrategyInfo> strategies = ass.GetAllStrategies(); InitPathStrategies(strategies); List <string> pathList = dic_Path_Strategies.Keys.ToList(); pathList.Sort(); for (int i = 0; i < pathList.Count; i++) { string path = pathList[i]; List <IStrategyInfo> strategiesInPath = dic_Path_Strategies[path]; TreeNode subNode = treeNode.Nodes.Add(path); AddStrategies(subNode, strategiesInPath); } }
public void TestStrategyAssembly() { IStrategyAssemblyMgr strategyMgr = GetStrategyMgr(); IStrategyAssembly assembly1 = strategyMgr.GetStrategyAssembly(assemblyName1); string path1 = "com.wer.sc.plugin.mock.strategy"; string path2 = "com.wer.sc.plugin.mock.zb"; string path3 = "com.wer.sc.plugin.mock.strategy.complex"; IList <String> rootPaths = assembly1.GetRootPath(); Assert.AreEqual(1, rootPaths.Count); Assert.AreEqual("com.wer.sc.plugin.mock", rootPaths[0]); IList <String> firstSubPaths = assembly1.GetSubPath(rootPaths[0]); Assert.AreEqual(2, firstSubPaths.Count); //TODO Assert.AreEqual(path1, firstSubPaths[1]); Assert.AreEqual(path2, firstSubPaths[0]); IList <StrategyInfo> strategyInfos = assembly1.GetSubStrategies(path1); Assert.AreEqual(2, strategyInfos.Count); AssertMockStrategy_TurningPoint(strategyInfos[0]); AssertMockStrategy_Volume(strategyInfos[1]); strategyInfos = assembly1.GetSubStrategies(path2); Assert.AreEqual(1, strategyInfos.Count); AssertMockStrategy_Ma(strategyInfos[0]); IList <string> subPath2 = assembly1.GetSubPath(path1); Assert.AreEqual(1, subPath2.Count); Assert.AreEqual(path3, subPath2[0]); Assert.AreEqual(null, assembly1.GetSubPath(path2)); strategyInfos = assembly1.GetSubStrategies(path3); AssertMockStrategy_Complex(strategyInfos[0]); IStrategyAssembly assembly2 = strategyMgr.GetStrategyAssembly(assemblyName2); Assert.AreEqual(3, assembly2.GetAllStrategies().Count); }