//Загрузка таблиц private TablsList Load(string prefix) { var tabls = new TablsList(); using (var db = new DaoDb(TestLib.CopyFile("Generator", "GenData.accdb", "Check" + prefix + ".accdb"))) { tabls.AddStruct(db, "Tabl", "SubTabl", "SubSubTabl"); tabls.AddDbStructs(db); } return(tabls); }
private SourceConnect MakeProviders(string prefix) { TestLib.CopyFile(@"Providers\Logika", "prolog.mdb", prefix + "Prolog.mdb"); var factory = new ProvidersFactory(); var logger = new Logger(new AppIndicator()); logger.History = new TestHistory(logger); var con = (SourceConnect)factory.CreateConnect(logger, ProviderType.Source, "SourceCon", "Logika"); var prov = factory.CreateProvider(logger, "LogikaSource", "DbFile=" + TestLib.TestRunDir + @"Providers\Logika\" + prefix + "Prolog.mdb"); con.JoinProvider(prov); return(con); }
public void Clone() { TestLib.CopyDir(@"Providers\Logika", "Clone"); TestLib.CopyFile(@"Providers\Logika", "prolog.mdb", "CloneProlog.mdb"); var app = new App("Test", new TestIndicator(), false); app.InitTest(); var con = new ClonerConnect(app); con.JoinProvider(app.ProvidersFactory.CreateProvider(app, "LogikaSource", "DbFile=" + TestLib.TestRunDir + @"Providers\Logika\CloneProlog.mdb")); var cloneDir = TestLib.TestRunDir + @"Providers\Logika\Clone\"; SysTabl.PutValueS(cloneDir + "Clone.accdb", "SourceInf", "DbFile=" + TestLib.TestRunDir + @"Providers\Logika\CloneProlog.mdb"); using (con.StartPeriod(D(0), D(24), "Single")) con.MakeClone(cloneDir); TestLib.CompareClones(cloneDir + "Clone.accdb", cloneDir + "CorrectClone.accdb"); }
private SourceConnect MakeFictiveConnect(string prefix, bool makeReserve = false) { var factory = new ProvidersFactory(); var logger = new Logger(new AppIndicator()); logger.History = new TestHistory(logger); var connect = (SourceConnect)factory.CreateConnect(logger, ProviderType.Source, "TestSource", "Fictive"); TestLib.CopyFile(@"Providers\Fictive", "Fictive.accdb", "Fictive" + prefix + ".accdb"); var source = (FictiveSource)factory.CreateProvider(logger, "FictiveSource", @"DbFile=" + TestLib.TestRunDir + @"Providers\Fictive\Fictive" + prefix + ".accdb"); FictiveSource source2 = null; if (makeReserve) { source2 = (FictiveSource)factory.CreateProvider(logger, "FictiveSource", @"DbFile=" + TestLib.TestRunDir + @"Providers\Fictive\Fictive" + prefix + ".accdb"); } connect.JoinProvider(source, source2); return(connect); }
private void Generate(string tablName, string subTablName = null, bool copyRes = true) { var tabls = new TablsList(); using (var db = new DaoDb(TestLib.CopyFile("Generator", "GenData.accdb", "Gen" + tablName + "Data.accdb"))) { tabls.AddStruct(db, "Tabl", "SubTabl", "SubSubTabl"); tabls.AddDbStructs(db); tabls.LoadValues(db, true); } TestLib.CopyFile("Generator", "GenTemplate.accdb", "Gen" + tablName + "Template.accdb"); if (copyRes) { TestLib.CopyFile("Generator", "GenRes.accdb", "Gen" + tablName + "Res.accdb"); } TestLib.CopyFile("Generator", "CorrectGen" + tablName + ".accdb", "Gen" + tablName + "Correct.accdb"); var templatesFile = TestLib.TestRunDir + @"Generator\Gen" + tablName + "Template.accdb"; var table = new GenTemplateTable(tablName, "GenRule", "ErrMess", "CalcOn", "Id"); var subTable = subTablName == null ? null : new GenTemplateTable(subTablName, table, "GenRule", "ErrMess", "CalcOn", "Id", "ParentId"); var logger = new Logger(new AppIndicator()); logger.History = new TestHistory(logger); var generator = new ModuleGenerator(logger, tabls, templatesFile, table, subTable); var s = TestLib.TestRunDir + @"Generator\Gen" + tablName; if (copyRes) { generator.Generate(s + "Res.accdb", tablName, subTablName); } using (var db1 = new DaoDb(s + (copyRes ? "Res" : "Template") + ".accdb")) using (var db2 = new DaoDb(s + "Correct" + ".accdb")) { TestLib.CompareTables(db1, db2, tablName, "Id"); if (subTablName != null) { TestLib.CompareTables(db1, db2, subTablName, "Id"); } } }
//Открытие тестовых баз с копированием private DaoDb CopyDb(string prefix) { return(new DaoDb(TestLib.CopyFile("Libraries", "TablsData.accdb", "Tabls" + prefix + ".accdb"))); }