class Program
{
static void Main(string[] args)
{
IMailSender mailSender = new MockMailSender();
FormHandler formHandler = new FromHandler(mailSender);
fromHandler.Handle("test@test.com");
}
}
위의 manual dependecy injection 을 Ninject 로 바꾸면
using Ninject;
class Program
{
static void Main(string[] args)
{
var kernel = new StandardKernel();
Bind<IMailSender>.To<MockMailSender>();
FormHandler formHandler = new FromHandler(kernel.Get<IMailSender>());
fromHandler.Handle("test@test.com");
}
}
[WPF] Dependency Property Metadata (0) | 2022.04.19 |
---|---|
[WPF] Databinding (0) | 2022.04.18 |
[WPF] Pack uri (0) | 2022.04.15 |
c# (WPF) Data Binding 에 대해서 (0) | 2021.05.31 |
Dependency Injection 에 대해서 (0) | 2021.05.24 |
댓글 영역