public void ResolvingConcreteClassThroughConstructor() { kernel.AddComponent("spamservice", typeof(DefaultSpamServiceWithConstructor)); kernel.AddComponent("mailsender", typeof(DefaultMailSenderService)); kernel.AddComponent("templateengine", typeof(DefaultTemplateEngine)); DefaultMailSenderService mailservice = (DefaultMailSenderService)kernel["mailsender"]; DefaultTemplateEngine templateengine = (DefaultTemplateEngine)kernel["templateengine"]; Assert.IsNotNull(mailservice); Assert.IsNotNull(templateengine); expectedClient = kernel.GetHandler("spamservice").ComponentModel; expectedModels = new ArrayList(kernel.GetHandler("spamservice").ComponentModel.Constructors.FewerArgumentsCandidate.Dependencies); DefaultSpamServiceWithConstructor spamservice = (DefaultSpamServiceWithConstructor)kernel["spamservice"]; Assert.IsNotNull(spamservice); }
public void ResolvingConcreteClassThroughProperties() { kernel.AddComponent("spamservice", typeof(DefaultSpamService)); kernel.AddComponent("mailsender", typeof(DefaultMailSenderService)); kernel.AddComponent("templateengine", typeof(DefaultTemplateEngine)); DefaultMailSenderService mailservice = (DefaultMailSenderService)kernel["mailsender"]; DefaultTemplateEngine templateengine = (DefaultTemplateEngine)kernel["templateengine"]; Assert.IsNotNull(mailservice); Assert.IsNotNull(templateengine); expectedClient = kernel.GetHandler("spamservice").ComponentModel; expectedModels = new ArrayList(); foreach (PropertySet prop in kernel.GetHandler("spamservice").ComponentModel.Properties) { expectedModels.Add(prop.Dependency); } DefaultSpamService spamservice = (DefaultSpamService)kernel["spamservice"]; Assert.IsNotNull(spamservice); }
public DefaultSpamServiceWithConstructor(DefaultMailSenderService mailsender, DefaultTemplateEngine templateEngine) { mailSender = mailsender; this.templateEngine = templateEngine; }
public DefaultSpamServiceWithConstructor(DefaultMailSenderService mailsender, DefaultTemplateEngine templateEngine) { mailSender = mailsender; this.templateEngine = templateEngine; }