public void Test2App() { demo.App app1 = demo.App.Instance; demo.App app2 = new demo.App(); var config1 = global::Zeze.Config.Load(); var config2 = global::Zeze.Config.Load(); config2.AutoKeyLocalId = config1.AutoKeyLocalId + 1; app1.Start(config1); app2.Start(config2); try { // 只删除一个app里面的记录就够了。 Assert.IsTrue(Procedure.Success == app1.Zeze.NewProcedure(() => { app1.demo_Module1.Table1.Remove(6785); return(Procedure.Success); }, "RemoveClean").Call()); Task[] task2 = new Task[2]; int count = 2000; task2[0] = global::Zeze.Util.Task.Run(() => ConcurrentAdd(app1, count, 1), "TestGlobal.ConcurrentAdd1"); task2[1] = global::Zeze.Util.Task.Run(() => ConcurrentAdd(app2, count, 2), "TestGlobal.ConcurrentAdd2"); Task.WaitAll(task2); int countall = count * 2; Assert.IsTrue(Procedure.Success == app1.Zeze.NewProcedure(() => { int last1 = app1.demo_Module1.Table1.Get(6785).Int1; Assert.AreEqual(countall, last1); //Console.WriteLine("app1 " + last1); return(Procedure.Success); }, "CheckResult1").Call()); Assert.IsTrue(Procedure.Success == app2.Zeze.NewProcedure(() => { int last2 = app2.demo_Module1.Table1.Get(6785).Int1; Assert.AreEqual(countall, last2); //Console.WriteLine("app1 " + last2); return(Procedure.Success); }, "CheckResult2").Call()); } finally { app1.Stop(); app2.Stop(); } }
//[TestMethod] public void Test2AppSameLocalId() { demo.App app1 = demo.App.Instance; demo.App app2 = new demo.App(); var config1 = global::Zeze.Config.Load(); var config2 = global::Zeze.Config.Load(); try { app1.Start(config1); app2.Start(config2); } finally { app1.Stop(); app2.Stop(); } }