public void ResolveMany_ResolvesInterface() { // Get all instances of the ITestInterface class. Ensure there's more than one found. var allTestInterfaces = MEFBootstrapper.ResolveMany <ITestInterface>(); Assert.AreNotEqual <int>(allTestInterfaces.Count(), 0); }
public void ResolveManyWithMetaData_ResolvesInterfaceAndMetadata() { // Get all instances, with the metadata, and ensure the metadata has values. var allTestInterfaces = MEFBootstrapper.ResolveManyWithMetaData <ITestInterface, ITestMetadata>(); Assert.AreNotEqual <int>(allTestInterfaces.Count(), 0); Assert.AreEqual(allTestInterfaces.FirstOrDefault().Metadata.Value, "TestValue"); }
/// <summary> /// Loads dialogue components into the global variables stored in this class. /// </summary> private static void LoadDialogueComponents() { dialogueActions = MEFBootstrapper.ResolveManyWithMetaData <IDialogueAction, IConversationComponentMetadata>() .ToDictionary(x => x.Metadata.Description, x => x.Value); log.LogMessage($"{ dialogueActions.Count } actions loaded for the conversation engine."); dialogueChecks = MEFBootstrapper.ResolveManyWithMetaData <IExecutionAllowance, IConversationComponentMetadata>() .ToDictionary(x => x.Metadata.Description, x => x.Value); log.LogMessage($"{ dialogueChecks.Count } checks loaded for the conversation engine."); }
static void InitializeScene() { #if UNITY_EDITOR // Dependency Injection // MEFBootstrapper.RegisterPath(UnityEngine.Application.dataPath + "/../Library/ScriptAssemblies"); #endif MEFBootstrapper.Build(); // Logging LoggerManager.StartLogging(); LoggerManager.CreateLogger(typeof(CoreManager)).LogMessage($"Initialization Complete."); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); // Allow File Browsing/File Viewing in Development. // app.UseDirectoryBrowser(); app.UseStaticFiles(); } // Configure Routing app.UseMvc(routes => { routes.MapRoute("default", "{controller}/{action}", new { controller = "Home", action = "Index" }); }); MEFBootstrapper.Build(); LoggerManager.StartLogging(); }
public static void AssemblyInit(TestContext context) { MEFBootstrapper.Build(); }
/// <summary> /// Resolves any dependencies needed for this class. /// </summary> private void ResolveDependencies() { this.log.LogMessage($"Resolving dependencies for the damage system."); this.damageTypeCalculators = MEFBootstrapper.ResolveManyWithMetaData <IDamageTypeCalculator, IDamageTypeMetadata>() .ToDictionary(x => x.Metadata.DamageType, x => x.Value); }
public static void InitializeLoggerTests(TestContext testContext) { MEFBootstrapper.Build(); LoggerManager.StartLogging(); }
/// <summary> /// Intiializes dependencies by calling the catalog for all objects requested in this class, /// importing them from their various locations. /// </summary> private void InitializeDependencies() { MEFBootstrapper.ResolveDependencies(this); }