public void CanRegisterContainer() { CoreServiceRegistrationService svc = GetServiceRegistrationService(nameof(ServiceRegistryLoaderTest)); List <RegisterServiceRegistryContainerResult> results = svc.RegisterServiceRegistryContainers(Assembly.GetExecutingAssembly()); Expect.AreEqual(1, results.Count); CoreServices.ServiceRegistry registry = svc.GetServiceRegistry(results[0].Name); TestRegistryClass instance = registry.Get <TestRegistryClass>(); Expect.AreEqual(instance.SetByCtor, TestRegistryContainer.TestValue); Expect.AreEqual(typeof(ConsoleLogger), instance.Logger.GetType()); }
public void ServiceRegistryLoaderTest() { CoreServiceRegistrationService svc = GetServiceRegistrationService(nameof(ServiceRegistryLoaderTest)); string name = nameof(ServiceRegistryLoaderTest); svc.RegisterServiceRegistryLoader(name, typeof(TestServiceRegistryContainer).GetMethod("Create"), true); CoreServices.ServiceRegistry reg = svc.GetServiceRegistry(name); TestMonkey value = reg.Get <TestMonkey>(); Expect.AreEqual("SomeValue", value.Name); Expect.IsNull(value.Logger); reg.SetProperties(value); Expect.IsObjectOfType <ConsoleLogger>(value.Logger); }