public void AddBindings()
        {
            kernel.Bind<IProductRepository>().To<EFProductRepository>();
            //Mock<IProductRepository> mock = new Mock<IProductRepository>();
            //mock.Setup(m => m.Products).Returns(new List<Product>
            //{
            //    new Product { Name="Football", Price=25 },
            //    new Product { Name="Surf board", Price=179 },
            //    new Product { Name="Running shoes", Price=95 }
            //});

            //kernel.Bind<IProductRepository>().ToConstant(mock.Object);

            EmailSettings emailSettings = new EmailSettings
            {
                WriteAsFile = bool.Parse(ConfigurationManager.AppSettings["Email.WriteAsFile"] ?? "false")
            };

            kernel.Bind<IOrderProcessor>().To<EmailOrderProcessor>().WithConstructorArgument("settings", emailSettings);
        }
예제 #2
0
 public EmailOrderProcessor(EmailSettings settings)
 {
     emailSettings = settings;
 }