public void Initialization() { Assert.That(_cache.ValueDiscoveryService, Is.InstanceOf(typeof(ExtensibleEnumValueDiscoveryService))); Assert.That( ((ExtensibleEnumValueDiscoveryService)_cache.ValueDiscoveryService).TypeDiscoveryService, Is.SameAs(ContextAwareTypeUtility.GetTypeDiscoveryService())); }
public void GetTypeDiscoveryService_ComesFromConfiguration() { TypeDiscoveryConfiguration.Current.Mode = TypeDiscoveryMode.CustomTypeDiscoveryService; TypeDiscoveryConfiguration.Current.CustomTypeDiscoveryService.Type = typeof(FakeTypeDiscoveryService); var defaultService = ContextAwareTypeUtility.GetTypeDiscoveryService(); Assert.That(defaultService, Is.InstanceOf(typeof(FakeTypeDiscoveryService))); }
public void GetTypeDiscoveryService_Cached() { TypeDiscoveryConfiguration.Current.Mode = TypeDiscoveryMode.CustomTypeDiscoveryService; TypeDiscoveryConfiguration.Current.CustomTypeDiscoveryService.Type = typeof(FakeTypeDiscoveryService); var defaultService = ContextAwareTypeUtility.GetTypeDiscoveryService(); var defaultService2 = ContextAwareTypeUtility.GetTypeDiscoveryService(); Assert.That(defaultService, Is.SameAs(defaultService2)); }
// This ctor is required when the MappingReflector is instantiated as a configuration element from a config file. public MappingReflector() : this( ContextAwareTypeUtility.GetTypeDiscoveryService(), new ClassIDProvider(), SafeServiceLocator.Current.GetInstance <IMemberInformationNameResolver>(), new PropertyMetadataReflector(), new DomainModelConstraintProvider(), CreateDomainObjectCreator()) { }
public void SetUp() { var validationTestDomainNamespace = typeof(AbstractMixinWithoutBase).Namespace; var globalTestDomainNamespace = typeof(BaseType1).Namespace; var typeDiscoveryService = FilteringTypeDiscoveryService.CreateFromNamespaceWhitelist( ContextAwareTypeUtility.GetTypeDiscoveryService(), validationTestDomainNamespace, globalTestDomainNamespace); var types = typeDiscoveryService.GetTypes(null, false); _configurationScope = DeclarativeConfigurationBuilder.BuildConfigurationFromTypes(null, types.Cast <Type>()).EnterScope(); }
public void GetTypeDiscoveryService_DesignModeContext() { var typeDiscoveryServiceStub = MockRepository.GenerateStub <ITypeDiscoveryService>(); var designerHostMock = MockRepository.GenerateStub <IDesignerHost>(); designerHostMock.Expect(_ => _.GetService(typeof(ITypeDiscoveryService))).Return(typeDiscoveryServiceStub); DesignerUtility.SetDesignMode(new StubDesignModeHelper(designerHostMock)); Assert.That(ContextAwareTypeUtility.GetTypeDiscoveryService(), Is.SameAs(typeDiscoveryServiceStub)); designerHostMock.VerifyAllExpectations(); }
private static void Main(string[] args) { Console.WriteLine("{0} - Application started", DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss,fff")); XmlConfigurator.Configure(); var typeDiscoveryService = ContextAwareTypeUtility.GetTypeDiscoveryService(); var domainObjectType = Type.GetType("Remotion.Data.DomainObjects.DomainObject, Remotion.Data.DomainObjects", true, false); typeDiscoveryService.GetTypes(domainObjectType, false); typeDiscoveryService.GetTypes(domainObjectType, false); using (StopwatchScope.CreateScope(Console.Out, "Reading IoC Configuration: {elapsed}")) { var p = new DefaultServiceConfigurationDiscoveryService(typeDiscoveryService); p.GetDefaultConfiguration().ToList(); } }
public void SetUp() { _oldTypeDiscoveryService = ContextAwareTypeUtility.GetTypeDiscoveryService(); _oldTypeDiscoveryConfiguration = TypeDiscoveryConfiguration.Current; _oldTypeResolutionService = ContextAwareTypeUtility.GetTypeResolutionService(); _oldTypeResolutionConfiguration = TypeResolutionConfiguration.Current; PrivateInvoke.SetNonPublicStaticField( typeof(ContextAwareTypeUtility), "s_defaultTypeDiscoveryService", new Lazy <ITypeDiscoveryService> (() => TypeDiscoveryConfiguration.Current.CreateTypeDiscoveryService())); PrivateInvoke.SetNonPublicStaticField( typeof(ContextAwareTypeUtility), "s_defaultTypeResolutionService", new Lazy <ITypeResolutionService> (() => TypeResolutionConfiguration.Current.CreateTypeResolutionService())); DesignerUtility.ClearDesignMode(); TypeDiscoveryConfiguration.SetCurrent(new TypeDiscoveryConfiguration()); TypeResolutionConfiguration.SetCurrent(new TypeResolutionConfiguration(new DefaultTypeResolutionService())); }
public static DefaultServiceConfigurationDiscoveryService Create() { return(new DefaultServiceConfigurationDiscoveryService(ContextAwareTypeUtility.GetTypeDiscoveryService())); }
// Separate method because of tests private static ITypeDiscoveryService GetTypeDiscoveryService() { return(ContextAwareTypeUtility.GetTypeDiscoveryService()); }
public DiscoveryServiceBasedValidationCollectorReflector(IValidatedTypeResolver validatedTypeResolver) : this(ContextAwareTypeUtility.GetTypeDiscoveryService(), validatedTypeResolver) { }
public void Initialization_DefaultTypeDiscoveryService() { var reflector = new MappingReflector(); Assert.That(reflector.TypeDiscoveryService, Is.SameAs(ContextAwareTypeUtility.GetTypeDiscoveryService())); }
public void GetTypeDiscoverySerivce() { Assert.That(ContextAwareTypeDiscoveryUtility.GetTypeDiscoveryService(), Is.SameAs(ContextAwareTypeUtility.GetTypeDiscoveryService())); }
public ExtensibleEnumValueDiscoveryService() { _typeDiscoveryService = ContextAwareTypeUtility.GetTypeDiscoveryService(); }