Skip to content

Instantly share code, notes, and snippets.

@kmcginnes
Created January 30, 2015 21:05
Show Gist options
  • Save kmcginnes/76d935abdd2a499fef1f to your computer and use it in GitHub Desktop.
Save kmcginnes/76d935abdd2a499fef1f to your computer and use it in GitHub Desktop.
Test the Castle Windsor Container
public class describe_ioc_container
{
It should_be_able_to_resolve_all_registered_components = () =>
{
var bootstrapper = new AppBootstrapper(false);
var host = (IDiagnosticsHost) bootstrapper.Container.Kernel.GetSubSystem(SubSystemConstants.DiagnosticsKey);
var diagnostics = host.GetDiagnostic<IPotentiallyMisconfiguredComponentsDiagnostic>();
var handlers = diagnostics.Inspect();
if (handlers.Any())
{
var message = new StringBuilder();
var inspector = new DependencyInspector(message);
foreach (IExposeDependencyInfo handler in handlers)
{
handler.ObtainDependencyDetails(inspector);
}
Console.WriteLine(message);
message.Length.Should().Be(0);
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment