Created
February 5, 2013 03:01
-
-
Save droyad/4711796 to your computer and use it in GitHub Desktop.
Testing Autofac registrations
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
| var sb = new StringBuilder(); | |
| foreach (var src in container.ComponentRegistry.Sources.Select(s => s.ToString()).OrderBy(s => s)) | |
| sb.AppendLine(src); | |
| sb.AppendLine(); | |
| foreach (var reg in container.ComponentRegistry.Registrations.OrderBy(r => r.Activator.LimitType.FullName)) | |
| { | |
| sb.AppendLine(reg.Activator.LimitType.FullName); | |
| sb.Append(" ").AppendLine(reg.Lifetime.GetType().Name); | |
| foreach (var svc in reg.Services.OrderBy(s => s.Description)) | |
| sb.Append(" ").AppendLine(svc.Description); | |
| sb.AppendLine(); | |
| } | |
| var result = Regex.Replace(sb.ToString(), @"Version=[0-9\.]+", "Version=_________"); | |
| Approvals.Verify(result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment