Created
June 10, 2013 07:21
-
-
Save Buthrakaur/5747058 to your computer and use it in GitHub Desktop.
WindsorConfigurationTests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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