public void DicDiffDebug(Config cfg, Config anotherCfg) { var diffActiveAppProjectGenerators = DicDiffResult <string, IvPluginGenerator> .DicDiff(cfg.DicActiveAppProjectGenerators, anotherCfg.DicActiveAppProjectGenerators); Assert.AreEqual(0, diffActiveAppProjectGenerators.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffActiveAppProjectGenerators.Dic2ButNotInDic1.Count); var diffGenerators = DicDiffResult <string, IvPluginGenerator> .DicDiff(cfg.DicGenerators, anotherCfg.DicGenerators); Assert.AreEqual(0, diffGenerators.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffGenerators.Dic2ButNotInDic1.Count); var diffNodes = DicDiffResult <string, ITreeConfigNode> .DicDiff(cfg.DicNodes, anotherCfg.DicNodes); Assert.AreEqual(0, diffNodes.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffNodes.Dic2ButNotInDic1.Count); var diffPlugins = DicDiffResult <string, IvPlugin> .DicDiff(cfg.DicPlugins, anotherCfg.DicPlugins); Assert.AreEqual(0, diffPlugins.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffPlugins.Dic2ButNotInDic1.Count); var diffPluginLists = DicDiffResult <vPluginLayerTypeEnum, List <PluginRow> > .DicDiff(cfg.DicPluginLists, anotherCfg.DicPluginLists); Assert.AreEqual(0, diffPluginLists.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffPluginLists.Dic2ButNotInDic1.Count); }
public void Plugin004WorkWithAppGeneratorSettings() { _logger.LogTrace("Start test".CallerInfo()); var vm = new MainPageVM(false); vm.OnFormLoaded(); vm.Compose(MainPageVM.GetvSharpStudioPluginsPath()); vm.CommandConfigSaveAs.Execute(@".\"); var pluginNode = (from p in vm.Config.GroupPlugins.ListPlugins where p.VPlugin is vPlugin.Sample.SamplePlugin select p).Single(); var genDb = (IvPluginDbGenerator)(from p in pluginNode.ListGenerators where p.Generator is vPlugin.Sample.GeneratorDbSchema select p).Single().Generator; var genDbAccess = (IvPluginGenerator)(from p in pluginNode.ListGenerators where p.Generator is vPlugin.Sample.GeneratorDbAccess select p).Single().Generator; vm.CommandConfigSaveAs.Execute(@"..\..\..\..\TestApps\OldProject\test1.vcfg"); var sln = (AppSolution)vm.Config.GroupAppSolutions.NodeAddNewSubNode(); sln.RelativeAppSolutionPath = @"..\..\..\..\TestApps\OldProject\Solution.sln"; var prj = (AppProject)sln.NodeAddNewSubNode(); prj.RelativeAppProjectPath = @"..\..\..\..\TestApps\OldProject\ConsoleApp1\ConsoleApp1.csproj"; var gen = (AppProjectGenerator)prj.NodeAddNewSubNode(); gen.RelativePathToGenFolder = @"..\..\..\..\TestApps\OldProject\ConsoleApp1\Generated"; gen.GenFileName = "test_file.cs"; gen.PluginGuid = pluginNode.Guid; gen.PluginGeneratorGuid = genDbAccess.Guid; var prms = (vPlugin.Sample.GeneratorDbAccessSettings)gen.DynamicGeneratorSettings; prms.IsAccessParam1 = true; prms.IsAccessParam2 = false; prms.AccessParam3 = "kuku3"; prms.AccessParam4 = "kuku4"; var prmsGroup = (vPlugin.Sample.PluginsGroupSettings)gen.GetPluginsGroupSettings(); prmsGroup.IsGroupParam1 = true; Assert.AreEqual(1, vm.Config.DicActiveAppProjectGenerators.Count); Assert.AreEqual(1, vm.Config.Model.GroupCommon.ListNodeGeneratorsSettings.Count); Assert.AreEqual(1, vm.Config.Model.GroupConstantGroups.ListNodeGeneratorsSettings.Count); Assert.AreEqual(1, vm.Config.Model.GroupEnumerations.ListNodeGeneratorsSettings.Count); Assert.AreEqual(1, vm.Config.Model.GroupCatalogs.ListNodeGeneratorsSettings.Count); Assert.AreEqual(1, vm.Config.Model.GroupDocuments.ListNodeGeneratorsSettings.Count); Assert.AreEqual(2, gen.ListGenerators.Count); Assert.IsNotNull(gen.DynamicGeneratorSettings); Assert.AreEqual(typeof(vPlugin.Sample.GeneratorDbAccessSettings).Name, gen.DynamicGeneratorSettings.GetType().Name); Assert.IsNotNull(vm.Config.Model.DynamicNodesSettings); //Assert.IsNotNull(vm.Config.Model.DynamicNodeDefaultSettings); //Assert.AreEqual(typeof(vPlugin.Sample.GeneratorDbAccessNodeSettings).Name, vm.Config.Model.DynamicNodesSettings.GetType().Name); vm.CommandConfigSave.Execute(null); var vm2 = new MainPageVM(true); vm2.OnFormLoaded(); vm2.Compose(MainPageVM.GetvSharpStudioPluginsPath()); Assert.AreEqual(1, vm2.Config.GroupAppSolutions.Count()); Assert.AreEqual(sln.RelativeAppSolutionPath, vm2.Config.GroupAppSolutions[0].RelativeAppSolutionPath); Assert.AreEqual(1, vm2.Config.GroupAppSolutions[0].ListAppProjects.Count()); Assert.AreEqual(1, vm2.Config.GroupAppSolutions[0].ListAppProjects[0].ListAppProjectGenerators.Count()); var gen2 = vm2.Config.GroupAppSolutions[0].ListAppProjects[0].ListAppProjectGenerators[0]; Assert.AreEqual(gen.RelativePathToGenFolder, gen2.RelativePathToGenFolder); Assert.AreEqual(gen.GenFileName, gen2.GenFileName); Assert.AreEqual(gen.PluginGuid, gen2.PluginGuid); Assert.AreEqual(gen.PluginGeneratorGuid, gen2.PluginGeneratorGuid); Assert.AreEqual(2, gen2.ListGenerators.Count); Assert.IsNotNull(gen2.DynamicGeneratorSettings); Assert.AreEqual(typeof(vPlugin.Sample.GeneratorDbAccessSettings).Name, gen2.DynamicGeneratorSettings.GetType().Name); Assert.IsNotNull(vm2.Config.Model.DynamicNodesSettings); vm2.Config.SelectedNode = gen2; //Assert.IsNotNull(gen2.DynamicNodesSettings); var prms2 = (vPlugin.Sample.GeneratorDbAccessSettings)gen2.DynamicGeneratorSettings; Assert.AreEqual(prms.IsAccessParam1, prms2.IsAccessParam1); Assert.AreEqual(prms.IsAccessParam2, prms2.IsAccessParam2); Assert.AreEqual(prms.AccessParam3, prms2.AccessParam3); Assert.AreEqual(prms.AccessParam4, prms2.AccessParam4); var prmsGroup2 = (vPlugin.Sample.PluginsGroupSettings)gen2.GetPluginGroupSettings(vPlugin.Sample.PluginsGroupSettings.GuidStatic); Assert.IsTrue(prmsGroup2.IsGroupParam1); #region DicDiffResult var diffActiveAppProjectGenerators = DicDiffResult <string, IvPluginGenerator> .DicDiff(vm.Config.DicActiveAppProjectGenerators, vm2.Config.DicActiveAppProjectGenerators); Assert.AreEqual(0, diffActiveAppProjectGenerators.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffActiveAppProjectGenerators.Dic2ButNotInDic1.Count); var diffGenerators = DicDiffResult <string, IvPluginGenerator> .DicDiff(vm.Config.DicGenerators, vm2.Config.DicGenerators); Assert.AreEqual(0, diffGenerators.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffGenerators.Dic2ButNotInDic1.Count); var diffPlugins = DicDiffResult <string, IvPlugin> .DicDiff(vm.Config.DicPlugins, vm2.Config.DicPlugins); Assert.AreEqual(0, diffPlugins.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffPlugins.Dic2ButNotInDic1.Count); var diffPluginLists = DicDiffResult <vPluginLayerTypeEnum, List <PluginRow> > .DicDiff(vm.Config.DicPluginLists, vm2.Config.DicPluginLists); Assert.AreEqual(0, diffPluginLists.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffPluginLists.Dic2ButNotInDic1.Count); var diffNodes = DicDiffResult <string, ITreeConfigNode> .DicDiff(vm.Config.DicNodes, vm2.Config.DicNodes); Assert.AreEqual(0, diffNodes.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffNodes.Dic2ButNotInDic1.Count); #endregion DicDiffResult vm2.Config.ValidateSubTreeFromNode(vm.Config); Assert.IsTrue(vm2.Config.CountErrors == 0); vm2.Config.DebugTag = "stop"; vm2.CommandConfigCurrentUpdate.Execute(new TestTransformation()); #region DicDiffResult diffActiveAppProjectGenerators = DicDiffResult <string, IvPluginGenerator> .DicDiff(vm2.Config.DicActiveAppProjectGenerators, vm2.Config.PrevCurrentConfig.DicActiveAppProjectGenerators); Assert.AreEqual(0, diffActiveAppProjectGenerators.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffActiveAppProjectGenerators.Dic2ButNotInDic1.Count); diffGenerators = DicDiffResult <string, IvPluginGenerator> .DicDiff(vm2.Config.DicGenerators, (vm2.Config.PrevCurrentConfig as Config).DicGenerators); Assert.AreEqual(0, diffGenerators.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffGenerators.Dic2ButNotInDic1.Count); diffPlugins = DicDiffResult <string, IvPlugin> .DicDiff(vm2.Config.DicPlugins, (vm2.Config.PrevCurrentConfig as Config).DicPlugins); Assert.AreEqual(0, diffPlugins.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffPlugins.Dic2ButNotInDic1.Count); diffPluginLists = DicDiffResult <vPluginLayerTypeEnum, List <PluginRow> > .DicDiff(vm2.Config.DicPluginLists, (vm2.Config.PrevCurrentConfig as Config).DicPluginLists); Assert.AreEqual(0, diffPluginLists.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffPluginLists.Dic2ButNotInDic1.Count); diffNodes = DicDiffResult <string, ITreeConfigNode> .DicDiff(vm2.Config.DicNodes, vm2.Config.PrevCurrentConfig.DicNodes); //Assert.AreEqual(0, diffNodes.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffNodes.Dic2ButNotInDic1.Count); #endregion DicDiffResult gen2 = (AppProjectGenerator)vm2.Config.PrevCurrentConfig.GroupAppSolutions[0].ListAppProjects[0].ListAppProjectGenerators[0]; prms2 = (vPlugin.Sample.GeneratorDbAccessSettings)gen2.DynamicGeneratorSettings; Assert.AreEqual(prms.IsAccessParam1, prms2.IsAccessParam1); Assert.AreEqual(prms.IsAccessParam2, prms2.IsAccessParam2); Assert.AreEqual(prms.AccessParam3, prms2.AccessParam3); Assert.AreEqual(prms.AccessParam4, prms2.AccessParam4); vm2.Config.ValidateSubTreeFromNode(vm.Config); Assert.IsTrue(vm2.Config.CountErrors == 0); vm2.CommandConfigCreateStableVersion.Execute(new TestTransformation()); #region DicDiffResult diffActiveAppProjectGenerators = DicDiffResult <string, IvPluginGenerator> .DicDiff(vm2.Config.DicActiveAppProjectGenerators, vm2.Config.PrevCurrentConfig.DicActiveAppProjectGenerators); Assert.AreEqual(0, diffActiveAppProjectGenerators.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffActiveAppProjectGenerators.Dic2ButNotInDic1.Count); diffGenerators = DicDiffResult <string, IvPluginGenerator> .DicDiff(vm2.Config.DicGenerators, (vm2.Config.PrevCurrentConfig as Config).DicGenerators); Assert.AreEqual(0, diffGenerators.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffGenerators.Dic2ButNotInDic1.Count); diffPlugins = DicDiffResult <string, IvPlugin> .DicDiff(vm2.Config.DicPlugins, (vm2.Config.PrevCurrentConfig as Config).DicPlugins); Assert.AreEqual(0, diffPlugins.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffPlugins.Dic2ButNotInDic1.Count); diffPluginLists = DicDiffResult <vPluginLayerTypeEnum, List <PluginRow> > .DicDiff(vm2.Config.DicPluginLists, (vm2.Config.PrevCurrentConfig as Config).DicPluginLists); Assert.AreEqual(0, diffPluginLists.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffPluginLists.Dic2ButNotInDic1.Count); diffNodes = DicDiffResult <string, ITreeConfigNode> .DicDiff(vm2.Config.DicNodes, vm2.Config.PrevCurrentConfig.DicNodes); //Assert.AreEqual(0, diffNodes.Dic1ButNotInDic2.Count); Assert.AreEqual(0, diffNodes.Dic2ButNotInDic1.Count); #endregion DicDiffResult gen2 = (AppProjectGenerator)vm2.Config.PrevStableConfig.GroupAppSolutions[0].ListAppProjects[0].ListAppProjectGenerators[0]; prms2 = (vPlugin.Sample.GeneratorDbAccessSettings)gen2.DynamicGeneratorSettings; Assert.AreEqual(prms.IsAccessParam1, prms2.IsAccessParam1); Assert.AreEqual(prms.IsAccessParam2, prms2.IsAccessParam2); Assert.AreEqual(prms.AccessParam3, prms2.AccessParam3); Assert.AreEqual(prms.AccessParam4, prms2.AccessParam4); }