public void InitializeAsync_CircularDependency_Exception() { // ARRANGE ModuleManager manager = new ModuleManager(); manager.AddModule(name: "Module1", entryPoint: "", dependsOn: new[] { "Module2", "Module3" }); manager.AddModule(name: "Module2", entryPoint: "", dependsOn: "Module1"); manager.AddModule(name: "Module3", entryPoint: "", dependsOn: "Module1"); // ACT try { manager.InitializeAsync().Wait(); Assert.Fail("CircularModuleDependencyException should have been thrown!"); } catch (AggregateException ex) { if (!ex.InnerExceptions.OfType <CircularModuleDependencyException>().Any() || ex.InnerExceptions.Count != 1) { Assert.Fail("CircularModuleDependencyException should have been thrown!"); } Debug.WriteLine("Exception message: {0}", ex.InnerExceptions[0].Message); } }
public void InitializeAsync_ModuleMissing_Exception() { // ARRANGE ModuleManager manager = new ModuleManager(); manager.AddModule(name: "Module1", entryPoint: "", dependsOn: new[] { "Module2", "Module3" }); manager.AddModule(name: "Module2", entryPoint: ""); // ACT try { manager.InitializeAsync().Wait(); Assert.Fail("ModuleLoadException should have been thrown!"); } catch (AggregateException ex) { if (!ex.InnerExceptions.OfType <ModuleLoadException>().Any() && ex.InnerExceptions.Count == 1) { Assert.Fail("ModuleLoadException should have been thrown!"); } } // ASSERT }
public void AddModule(object[] package) { attached.enabled = true; detached.enabled = false; try{ attached.Initialize((Collider2D)package[0], (int)package[1]); } catch { transform.SetParent((Transform)package[0]); try { transform.localPosition = (Vector2)package [1]; attached.gridLocation = (Vector2)package [1]; } catch { transform.localPosition = attached.gridLocation; } } foreach (GameObject edge in edges) { edge.SetActive(true); } if (rb != null) { Destroy(rb); } manager = gameObject.GetComponentInParent <ModuleManager> (); manager.AddModule(attached); ShipController controller = gameObject.GetComponentInParent <ShipController> (); if (controller != null) { type.Integrate(controller); } //GameManager.singleton.SaveEvent -= Save; }
public void WhenIAddTheModuleInTheModuleManager(string modulePath) { try { ModuleName = ModuleManager.AddModule(modulePath); } catch (ModuleException ex) { ModuleException = ex; } }
public void Start() { this.shader = LoadShader(); DrawManager.Initialize(); SpecialLootItemManager.Initialize(); ModuleManager.Initialize(); ModuleManager.AddModule(PlayerBoxModule._KeyCode, this.playerBoxModule); ModuleManager.AddModule(PlayerLabelModule._KeyCode, this.playerLabelModule); ModuleManager.AddModule(LootItemLabelModule._KeyCode, this.lootItemLabelModule); }
public void InitializeAsync_ModulesLoaded_Success() { // ARRANGE ModuleManager manager = new ModuleManager(); manager.AddModule(entryPoint: "Microsoft.TED.WinRT.Modules.Tests.MockModules.Module1,Microsoft.TED.WinRT.Modules.Tests", name: "Module1", dependsOn: new[] { "Module2" }); manager.AddModule(name: "Module2", entryPoint: "Microsoft.TED.WinRT.Modules.Tests.MockModules.Module2,Microsoft.TED.WinRT.Modules.Tests", dependsOn: "Module3"); manager.AddModule(name: "Module3", entryPoint: "Microsoft.TED.WinRT.Modules.Tests.MockModules.Module3,Microsoft.TED.WinRT.Modules.Tests"); manager.AddModule(name: "Module4", entryPoint: "Microsoft.TED.WinRT.Modules.Tests.MockModules.Module4,Microsoft.TED.WinRT.Modules.Tests"); manager.AddModule("Module5", "Microsoft.TED.WinRT.Modules.Tests.MockModules.Module5,Microsoft.TED.WinRT.Modules.Tests", "Module2", "Module4"); List <string> initializedOrder = new List <string>(); MockModuleBase.OnInitializeCalled = type => initializedOrder.Add(type.Name); // ACT manager.InitializeAsync().Wait(); // ASSERT Assert.AreEqual(5, initializedOrder.Count, "Not all modules were initialized"); Assert.AreEqual("Module3,Module4,Module2,Module5,Module1", initializedOrder.ConcatToString(","), "Invalid initialization order for modules"); }
public void InitializeAsync_FakeEntryPoints_Exception() { // ARRANGE ModuleManager manager = new ModuleManager(); manager.AddModule(name: "Module1", entryPoint: "FakeModule1", dependsOn: "Module2"); manager.AddModule(name: "Module2", entryPoint: "FakeModule2"); // ACT try { manager.InitializeAsync().Wait(); Assert.Fail("ModuleInitializeException should have been thrown!"); } catch (AggregateException ex) { if (!ex.InnerExceptions.OfType <ModuleInitializeException>().Any() && ex.InnerExceptions.Count == 1) { Assert.Fail("ModuleInitializeException should have been thrown!"); } } }
private ModuleResolver AddModule(byte[] dllBytes, bool ignoreDependencyIndexUpdate = true) { var resolver = new ModuleResolver(dllBytes); var manifest = resolver.GetModuleManifest(); if (ignoreDependencyIndexUpdate) { UpdateDependencyIndex(manifest); } GetTheme(resolver); ModuleManager.AddModule(manifest, resolver.Assembly); RouterManager.ResolveRouteInformation(resolver.Assembly); AuthenticationManager.Upload(dllBytes); return(resolver); }
public void AddMod(ModuleViewModel modVM) { try { tbl_Module tblModule = new tbl_Module(); tblModule.ApplicationId = modVM.ApplicationID; tblModule.ModuleName = modVM.ModuleName; tblModule.EntityState = DA.DomainModel.EntityState.Added; ModuleManager modManager = new ModuleManager(); modManager.AddModule(tblModule); } catch (Exception) { throw; } }
public void Regist() { m_ModuleManager.AddModule <PlayerModule>(); }
public void AddDependency <T>() where T : class, IModule { _moduleManager.AddModule <T>(); }