public void ActivatorShouldBeReturnedEvenIfNameDoesntMatchWhenRequestingDefaultService() { // Arrange var serviceType = typeof(IFoo); var activatorGroup = new DefaultActivatorGroup(serviceType); var defaultServiceIdentity = new ServiceIdentity(serviceType); var specialServiceIdentity = new ServiceIdentity(serviceType, "Special"); var specialActivator = new InstanceActivator(specialServiceIdentity, null); activatorGroup.Add(specialActivator); // Act var defaultActivator = activatorGroup.GetActivator(defaultServiceIdentity); // Assert Assert.AreSame(specialActivator, defaultActivator); }
private static IActivator[] GetActivators(DefaultActivatorGroup activatorGroup) { var activators = (IDictionary <ServiceIdentity, IActivator>)ActivatorsField.GetValue(activatorGroup); return(activators.Values.ToArray()); }
public DefaultActivatorGroupDebuggerTypeProxy(DefaultActivatorGroup activatorGroup) { Activators = GetActivators(activatorGroup); ServiceType = activatorGroup.ServiceType; }