public void ResolveJunkFood() { var builder = new ContainerBuilder(); builder.Register(c => JunkFoodFactory.Create("chicken meal")); var meal = builder.Build().Resolve <IMeal>(); var junk = Assert.IsAssignableFrom <JunkFood>(meal); Assert.Equal("chicken meal", junk.Name); }
public void ResolveJunkFood() { var container = new UnityContainer(); container.RegisterType <IMeal, JunkFood>( new InjectionFactory( c => JunkFoodFactory.Create("chicken meal"))); var meal = container.Resolve <IMeal>(); var junk = Assert.IsAssignableFrom <JunkFood>(meal); Assert.Equal("chicken meal", junk.Name); }
public void ResolveJunkFood() { var container = new WindsorContainer(); container.Register(Component .For <IMeal>() .UsingFactoryMethod(() => JunkFoodFactory.Create("chicken meal"))); var meal = container.Resolve <IMeal>(); var junk = Assert.IsAssignableFrom <JunkFood>(meal); Assert.Equal("chicken meal", junk.Name); }
public void ResolveJunkFood() { var container = new Container(); container.Configure(r => r .For <IMeal>() .Use(() => JunkFoodFactory.Create("chicken meal"))); var meal = container.GetInstance <IMeal>(); var junk = Assert.IsAssignableFrom <JunkFood>(meal); Assert.Equal("chicken meal", junk.Name); }
public JunkFoodAdapter() { this.junk = JunkFoodFactory.Create("chicken meal"); }