Hi there Im using windsor as a DI container,
my code is below
public static class ContainerBuilder
{
public static IWindsorContainer Build()
{
var container = new WindsorContainer("Configuration\\Windsor.config");
// automatically register controllers
container.Register(AllTypes
.Of<Controller>()
.FromAssembly(Assembly.GetExecutingAssembly())
.Configure(c => c.LifeStyle.Transient.Named(c.Implementation.Name.ToLower())));
container.Register(
Component.For<IServiceLocator>().Instance(new WindsorServiceLocator(container)),
Component.For(typeof(IRepository<>)).ImplementedBy(typeof(NHibernateRepository<>)).LifeStyle.Transient
);
return container;
}
}
I need to call this from a test project , the problem is that when I do this the windsor.config is never found and the test seems to always fail, where is the best way to place this config file or is there a better approach to doing this? Thanks