示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UmbMapperPublishedContentModelFactory"/> class.
        /// </summary>
        public UmbMapperPublishedContentModelFactory()
        {
            IReadOnlyCollection <IUmbMapperConfig> mappers = UmbMapperRegistry.CurrentMappers();

            if (mappers.Count == 0)
            {
                throw new InvalidOperationException("No mappers have been registered. Ensure that registration occures before initialization of this factory.");
            }

            this.registeredMappers = mappers.Where(m => typeof(IPublishedContent).IsAssignableFrom(m.MappedType));
        }
示例#2
0
 public void UmbMapperRegistryCanStoreMapper()
 {
     UmbMapperRegistry.AddMapper(new PublishedItemMap());
     Assert.True(UmbMapperRegistry.CurrentMappers().Any(m => m.MappedType == typeof(PublishedItem)));
 }