Exemple #1
0
        public override void SetUp()
        {
            base.SetUp();

            root  = CreateOneItem <RootNode>(1, "root", null);
            start = CreateOneItem <RootNode>(2, "start", root);
            host  = new Host(new ThreadContext(), root.ID, start.ID);

            fs          = new FakeMappedFileSystem();
            fs.BasePath = AppDomain.CurrentDomain.BaseDirectory + @"\FileSystem\";

            vnf    = new VirtualNodeFactory();
            config = new EditSection();

            injector = new FakeDependencyInjector();
            injector.injectors.Add(new EntityDependencySetter <IFileSystem>(fs));
            injector.injectors.Add(new EntityDependencySetter <IDependencyInjector>(injector));
            var sizeCache = new ImageSizeCache(new ConfigurationManagerWrapper {
                Sections = new ConfigurationManagerWrapper.ContentSectionTable(null, null, null, config)
            });

            injector.injectors.Add(new EntityDependencySetter <ImageSizeCache>(sizeCache));
            //nodeProvider = new FolderNodeProvider(fs, persister, injector);
            //initializer = new VirtualFolderInitializer(host, persister, fs, vnf, new Plugin.ConnectionMonitor().SetConnected(SystemStatusLevel.UpAndRunning), config, new ImageSizeCache(new ConfigurationManagerWrapper { Sections = new ConfigurationManagerWrapper.ContentSectionTable(null, null, null, config) }), nodeProvider);
            //nodeProvider = new FolderNodeProvider(fs, persister, injector);
            //nodeProvider = new FolderNodeProvider(fs, persister, injector);
            nodeProvider = new FolderNodeProvider(fs, persister.Repository, injector);
            initializer  = new VirtualFolderInitializer(host, persister, fs, vnf, monitor = new Plugin.ConnectionMonitor().SetConnected(SystemStatusLevel.UpAndRunning), new UploadFolderSource(host, config), nodeProvider);
        }
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            N2.Context.Replace(engine);

            Url.DefaultExtension = "/";
            Url.ApplicationPath  = "/";
            fs          = (FakeMappedFileSystem)engine.Resolve <IFileSystem>();
            fs.BasePath = basePath;

            fs.DirectoryCreated += (s, e) => Triggered("DirectoryCreated", e);
            fs.DirectoryDeleted += (s, e) => Triggered("DirectoryDeleted", e);
            fs.DirectoryMoved   += (s, e) => Triggered("DirectoryMoved", e);
            fs.FileCopied       += (s, e) => Triggered("FileCopied", e);
            fs.FileDeleted      += (s, e) => Triggered("FileDeleted", e);
            fs.FileMoved        += (s, e) => Triggered("FileMoved", e);
            fs.FileWritten      += (s, e) => Triggered("FileWritten", e);

            System.IO.Directory.Move(basePath, backupPath);
        }