private object LocateService(IServiceLocationStrategy serviceLocationStrategy) { object service = serviceLocationStrategy.LocateService(); Activated?.Invoke(service); return(service); }
public DependencyRegistrarTests() { _serviceEntryStoreMock = new Mock <IServiceEntryStore>(); _locationStrategyFactoryMock = new Mock <ILocationStrategyFactory>(); _dependencyRegistrar = new DependencyRegistrar(_serviceEntryStoreMock.Object, _locationStrategyFactoryMock.Object); _locationStrategy = new Mock <IServiceLocationStrategy>().Object; }
private static IServiceLocationStrategy[] SetupServiceLocationStrategies(int count) { IServiceLocationStrategy[] strategies = new IServiceLocationStrategy[count]; for (int index = 0; index < count; ++index) { strategies[index] = new Mock <IServiceLocationStrategy>().Object; } return(strategies); }
public void InsertHandler(ServiceEntry serviceEntry, IServiceLocationStrategy serviceLocationStrategy) { if (HasHandler(serviceEntry)) { _handlers[serviceEntry].Add(serviceLocationStrategy); } else { _handlers.Add(serviceEntry, new List <IServiceLocationStrategy> { serviceLocationStrategy }); } }
private IEnumerable <object> SetupIServiceHandlers(int count) { SetupHasIServiceHandler(); IServiceLocationStrategy[] strategies = new IServiceLocationStrategy[count]; for (int index = 0; index < strategies.Length; ++index) { strategies[index] = SetupServiceLocationStrategy(new Service()); } _serviceEntryStoreMock.Setup(store => store.RetrieveHandlers(NullKeyServiceEntry)) .Returns(strategies); return(strategies.Select(strategy => strategy.LocateService())); }
private void InsertHandler(IServiceLocationStrategy serviceLocationStrategy) { _serviceEntryStore.InsertHandler(DefaultServiceEntry, serviceLocationStrategy); }
private void InsertHandler(Type service, string key, IServiceLocationStrategy serviceLocationStrategy) { ServiceEntry serviceEntry = MakeServiceEntry(service, key); _serviceEntryStore.InsertHandler(serviceEntry, serviceLocationStrategy); }