Skip to content

Instantly share code, notes, and snippets.

@droyad
Created February 5, 2013 03:01
Show Gist options
  • Select an option

  • Save droyad/4711796 to your computer and use it in GitHub Desktop.

Select an option

Save droyad/4711796 to your computer and use it in GitHub Desktop.
Testing Autofac registrations
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