Ejemplo n.º 1
0
        public void AsRuntimeType_WithTypeAdapter_ReturnsRuntimeType()
        {
            var expectedType = typeof(TheType);
            ITypeInformation typeInformation = TypeAdapter.Create(expectedType);

            Assert.That(typeInformation.AsRuntimeType(), Is.SameAs(expectedType));
        }
Ejemplo n.º 2
0
        private IResourceManager GetResourceManagerFromType(ITypeInformation typeInformation)
        {
            var type = typeInformation.AsRuntimeType();

            if (type == null)
            {
                return(NullResourceManager.Instance);
            }

            var classContext = MixinConfiguration.ActiveConfiguration.GetContext(type);

            if (classContext == null)
            {
                return(NullResourceManager.Instance);
            }

            var resourceMangers = new List <IResourceManager>();

            CollectResourceManagersRecursively(classContext.Type, resourceMangers);

            if (resourceMangers.Any())
            {
                return(new ResourceManagerSet(resourceMangers));
            }

            return(NullResourceManager.Instance);
        }
        private IResourceManager GetResourceManagerImplementation(ITypeInformation typeInformation)
        {
            var runtimeType = typeInformation.AsRuntimeType();

            if (runtimeType == null)
            {
                return(NullResourceManager.Instance);
            }

            var result = _resourceManagerResolver.Resolve(runtimeType);

            return(result.ResourceManager);
        }