コード例 #1
0
        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));
        }
コード例 #2
0
        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)));
        }