Skip to content

Instantly share code, notes, and snippets.

@mausch
Created July 9, 2009 23:14
Show Gist options
  • Save mausch/144086 to your computer and use it in GitHub Desktop.
Save mausch/144086 to your computer and use it in GitHub Desktop.
using Castle.Windsor;
using NUnit.Framework;
namespace WindsorInitConfig {
[TestFixture]
public class NoResolutionTests {
public interface IServiceA {}
public class ServiceA: IServiceA {}
public class Service {
public IServiceA Svc { get; set; }
}
[Test]
public void NoPropInjection() {
var c = new WindsorContainer();
c.Kernel.ComponentModelCreated += model => {
if (model.Implementation == typeof(Service))
model.Properties.Clear();
};
c.AddComponent<IServiceA, ServiceA>();
c.AddComponent<Service>();
Assert.IsNull(c.Resolve<Service>().Svc);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment