예제 #1
0
        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);
        }
예제 #2
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");
        }
예제 #3
0
        /// <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.");
        }
예제 #4
0
    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.");
    }
예제 #5
0
        // 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();
        }
예제 #6
0
 public static void AssemblyInit(TestContext context)
 {
     MEFBootstrapper.Build();
 }
예제 #7
0
 /// <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);
 }
예제 #8
0
 public static void InitializeLoggerTests(TestContext testContext)
 {
     MEFBootstrapper.Build();
     LoggerManager.StartLogging();
 }
예제 #9
0
 /// <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);
 }