コード例 #1
0
        protected virtual void Init()
        {
            var attributeTypeRegistry = new CmsAttributeTypeRegistry();
            AttributeTypeRegistry.SetCurrent(attributeTypeRegistry);

            FrameworkContext = new FakeFrameworkContext();

            var hive = CreateHiveManager();
            
            RebelApplicationContext = CreateApplicationContext(hive);

            var resolverContext = new MockedMapResolverContext(FrameworkContext, hive, new MockedPropertyEditorFactory(RebelApplicationContext), new MockedParameterEditorFactory());
            var webmModelMapper = new CmsModelMapper(resolverContext);

            FrameworkContext.SetTypeMappers(new FakeTypeMapperCollection(new AbstractMappingEngine[] { webmModelMapper, new FrameworkModelMapper(FrameworkContext) }));

            DevDataset = DemoDataHelper.GetDemoData(RebelApplicationContext, attributeTypeRegistry);
            FixedPropertyEditors = new FixedPropertyEditors(RebelApplicationContext);

            //ensure model binders
            ModelBinders.Binders.Remove(typeof(HiveId));
            ModelBinders.Binders.Add(typeof(HiveId), new HiveIdModelBinder());
            ModelBinders.Binders.Remove(typeof(DocumentTypeEditorModel));
            ModelBinders.Binders.Add(typeof(DocumentTypeEditorModel), new DocumentTypeModelBinder());
            ModelBinders.Binders.Remove(typeof(SizeModelBinder));
            ModelBinders.Binders.Add(typeof(SizeModelBinder), new SizeModelBinder());

            //set the model meta data provider
            ModelMetadataProviders.Current = new RebelModelMetadataProvider();
        }
コード例 #2
0
 public MockedPropertyEditorFactory(IRebelApplicationContext appContext)
 {
     _propEditors = new FixedPropertyEditors(appContext).GetPropertyEditorDefinitions();
 }
コード例 #3
0
 public MockedPropertyEditorFactory(IRebelApplicationContext appContext)
 {
     _propEditors = new FixedPropertyEditors(appContext).GetPropertyEditorDefinitions();
 }