예제 #1
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");
        }
예제 #2
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.");
        }
예제 #3
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);
 }