static LambdaFunction() { var typeName = Environment.GetEnvironmentVariable(Constants.ConfigurationTypeNameKey); Model = MetaModelFactory.FromType(Type.GetType(typeName)); LambdaType = typeof(LambdaFunction <,>).MakeGenericType(Model.JourneyType, Model.JourneyTypeResult); Factory = () => (ILambdaFunction)Activator.CreateInstance(LambdaType, Model); }
private static void DoIncludeTest(string jsonFile, string codeFile) { string json = GetJson(jsonFile); string targetResult = GetTargetResult(codeFile); var model = JsonConvert.DeserializeObject <StrategyModel>(json); var generator = new StrategyGenerator(); var metaModel = MetaModelFactory.Create(model); var result = generator.Generate(metaModel); Assert.IsTrue(result.Contains(targetResult), string.Format("Target code not found: \n{0}\n in \n{1}", targetResult, result)); }
private static void DoTest(string jsonFile, string luaFile) { string json = GetJson(jsonFile); string targetResult = GetTargetResult(luaFile); var model = JsonConvert.DeserializeObject <StrategyModel>(json); var generator = new StrategyGenerator(new FileModuleProvider()); var metaModel = MetaModelFactory.Create(model); var result = generator.Generate(metaModel); Assert.AreEqual(targetResult, result, string.Format("Sources not equal: {0}", GetDiff(targetResult, result))); }
static BeetlesMetaModel LoadTypeInfo(string buildConfiguration, string buildFramework, string name) { var proj = new DirectoryInfo(Directory.GetCurrentDirectory()).Name; var assemblyDir = Path.Combine(Environment.CurrentDirectory, "bin", buildConfiguration, buildFramework, "publish"); var assemblyPath = Path.Combine(assemblyDir, proj + ".dll"); if (File.Exists(assemblyPath) == false) { throw new ArgumentException($"Could not find an assembly at {assemblyPath}"); } _shellAsm = new ShellAssemblyLoadContext(assemblyDir); var assembly = _shellAsm.LoadFromAssemblyPath(assemblyPath); return(MetaModelFactory.FromAssembly(assembly, name)); }