Skip to content

Instantly share code, notes, and snippets.

@Buthrakaur
Created June 10, 2013 07:21
Show Gist options
  • Save Buthrakaur/5747058 to your computer and use it in GitHub Desktop.
Save Buthrakaur/5747058 to your computer and use it in GitHub Desktop.
WindsorConfigurationTests
public class WindsorConfigurationTests
{
private readonly WindsorContainer container;
public WindsorConfigurationTests()
{
container = new WindsorContainer();
container.Install(FromAssembly.Named("AppX"));
}
private static IHandler[] GetPotentiallyMisconfiguredComponents(WindsorContainer container)
{
var host = (IDiagnosticsHost)container.Kernel.GetSubSystem(SubSystemConstants.DiagnosticsKey);
var diagnostic = host.GetDiagnostic<IPotentiallyMisconfiguredComponentsDiagnostic>();
var handlers = diagnostic.Inspect();
return handlers;
}
[Fact]
public void Container_Should_NotContainAnyMisconfiguredComponents()
{
var misconfiguredComponents = GetPotentiallyMisconfiguredComponents(container);
var sb = new StringBuilder();
var depInspector = new DependencyInspector(sb);
misconfiguredComponents.Cast<IExposeDependencyInfo>()
.ForEach(x => x.ObtainDependencyDetails(depInspector));
Assert.True(misconfiguredComponents.IsNullOrEmpty(), sb.ToString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment