protected override void Load(ContainerBuilder builder) { DependencyResolverMixins.RegisterConstant(Locator.CurrentMutable, new FuncLogManager(type => new NLogLogger(type)), typeof(IFullLogger)); builder .Register((c, p) => new NLogLogger(p.TypedAs <Type>())) .As <ILogger>(); }
public void AllDefaultServicesShouldBeRegisteredPerRegistrationNamespace() { using (_resolver.WithResolver()) { var registrationNamespaces = new[] { DependencyResolverMixins.RegistrationNamespace.Wpf }; DependencyResolverMixins.SetRegistrationNamespaces(registrationNamespaces); foreach (var shouldRegistered in GetServicesThatShouldBeRegistered(registrationNamespaces)) { IEnumerable <object> resolvedServices = _resolver.GetServices(shouldRegistered.Key); Assert.Equal(shouldRegistered.Value.Count, resolvedServices.Count()); foreach (Type implementationType in shouldRegistered.Value) { var isRegistered = resolvedServices.Any(rs => rs.GetType() == implementationType); Assert.Equal(true, isRegistered); } } DependencyResolverMixins.SetRegistrationNamespaces(DependencyResolverMixins.DefaultRegistrationNamespaces.ToArray()); } }