public void UninitializeOrder2() { var order = new List <string>(); var config = new Config { Modules = { new ModuleInfo(new ModuleA(uninit: () => order.Add("moduleA"))), new ModuleInfo(new ModuleB(uninit: () => order.Add("moduleB"))) } }; var application = new KernelApplication(config, false); application.Initialize(); var moduleC = new ModuleC(uninit: () => order.Add("moduleC")); moduleC.Initialize(); application.AddModule(moduleC); application.Uninitialize(); Assert.AreEqual(3, order.Count); Assert.AreEqual("moduleB", order[0]); Assert.AreEqual("moduleA", order[1]); Assert.AreEqual("moduleC", order[2]); }
public void InitializeOrder() { var order = new List <string>(); var config = new Config { Modules = { new ModuleInfo(new ModuleA(() => order.Add("moduleA"))), new ModuleInfo(new ModuleB(() => order.Add("moduleB"))) } }; var application = new KernelApplication(config, false); application.Initialize(); Assert.AreEqual(2, order.Count); Assert.AreEqual("moduleA", order[0]); Assert.AreEqual("moduleB", order[1]); }
public void CreateModules() { var config = new Config { Modules = { new ModuleInfo(new ModuleA()), new ModuleInfo(new ModuleB()) } }; var application = new KernelApplication(config, false); application.Initialize(); bool result0 = application.TryGetModule(out ModuleA moduleA); bool result1 = application.TryGetModule(out ModuleB moduleB); Assert.True(result0); Assert.True(result1); Assert.NotNull(moduleA); Assert.NotNull(moduleB); }