Beispiel #1
0
        public FakeEngine(params Type[] types)
        {
            AddComponentInstance <ITypeFinder>(new FakeTypeFinder(types));
            var definitionManager = TestSupport.SetupDefinitions(types.Where(t => typeof(ContentItem).IsAssignableFrom(t)).ToArray());

            AddComponentInstance <IDefinitionManager>(definitionManager);
            var adapterProvider = new ContentAdapterProvider(this, Resolve <ITypeFinder>());

            AddComponentInstance <IContentAdapterProvider>(adapterProvider);
            var itemRepository = new FakeContentItemRepository();

            AddComponentInstance <IRepository <ContentItem> >(itemRepository);
            AddComponentInstance <IContentItemRepository>(itemRepository);
            var webContext = new ThreadContext();

            AddComponentInstance <IWebContext>(webContext);
            var host = new Host(webContext, 1, 1);

            AddComponentInstance <IHost>(host);
            var security = new FakeSecurityManager();

            AddComponentInstance <ISecurityManager>(security);
            var source = new ContentSource(security, new [] { new DatabaseSource(host, itemRepository) });

            AddComponentInstance(source);
            AddComponentInstance <IPersister>(new ContentPersister(source, itemRepository));
            AddComponentInstance <IWebContext>(webContext);
            var proxyFactory = new InterceptingProxyFactory();

            AddComponentInstance <IProxyFactory>(proxyFactory);
            var activator = new ContentActivator(new N2.Edit.Workflow.StateChanger(), new ItemNotifier(), proxyFactory);

            AddComponentInstance <ContentActivator>(activator);
            activator.Initialize(definitionManager.GetDefinitions());
        }
Beispiel #2
0
        public static ContentPersister SetupFakePersister(out IContentItemRepository repository, IProxyFactory proxyFactory = null)
        {
            repository = new Fakes.FakeContentItemRepository(proxyFactory);

            var sources = SetupContentSource(repository);

            return(new ContentPersister(sources, repository));
        }
Beispiel #3
0
        public static ContentPersister SetupFakePersister(out FakeContentItemRepository repository)
        {
            repository = new Fakes.FakeContentItemRepository();

            var sources = SetupContentSource(repository);

            return(new ContentPersister(sources, repository));
        }
 public FakeVersionManager(FakeContentItemRepository itemRepository, StateChanger stateChanger, params Type[] definitionTypes)
     : base(TestSupport.CreateVersionRepository(definitionTypes), itemRepository, stateChanger, new N2.Configuration.EditSection())
 {
     this.itemRepository = itemRepository;
 }