Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chivandikwa/31e5c2983a5a5731c235132f8e7ca331 to your computer and use it in GitHub Desktop.
Save chivandikwa/31e5c2983a5a5731c235132f8e7ca331 to your computer and use it in GitHub Desktop.
Verify SimpleInjector container with diagnostics
[Fact]
public void VerifyContainerWithDiagnostics()
{
Action containerVerificationAction = () => {
container.Verify(VerificationOption.VerifyAndDiagnose);
};
containerVerificationAction.Should().NotThrow();
DiagnosticResult[] res = Analyzer.Analyze(container);
res.Should().NotContain(result => result.Severity != DiagnosticSeverity.Information);
// Warnings that are ok can be suppressed on registration
// registration.SuppressDiagnosticWarning(DiagnosticType.DisposableTransientComponent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment