Exemplo n.º 1
0
        public TestMasterRepository()
        {
            createdDirectories = new List<string>();
            updatedDirectories = new List<string>();
            deletedDirectories = new List<string>();
            movedDirectories = new List<string>();

            createdPages = new List<string>();
            updatedPages = new List<string>();
            deletedPages = new List<string>();
            movedPages = new List<string>();

            watcher = new TestSourceWatcher();
            repository = new MasterRepository(".md");

            // setup event handlers
            repository.DirectoryAdded += (source, args) =>
                {
                    createdDirectories.Add(args.SourcePath);
                };
            repository.DirectoryUpdated += (source, args) =>
                {
                    updatedDirectories.Add(args.SourcePath);
                };
            repository.DirectoryDeleted += (source, args) =>
                {
                    deletedDirectories.Add(args.SourcePath);
                };
            repository.DirectoryMoved += (source, args) => movedDirectories.Add(args.SourcePath);

            repository.PageAdded += (source, args) =>
            {
                createdPages.Add(args.SourcePath);
            };

            repository.PageUpdated += (source, args) =>
            {
                updatedPages.Add(args.SourcePath);
            };

            repository.PageDeleted += (source, args) =>
            {
                deletedPages.Add(args.SourcePath);
            };

            repository.PageMoved += (source, args) =>
            {
                movedPages.Add(args.SourcePath);
            };

            // create list of files
            IList<string> markdownFiles = new List<string>
                {
                    Path.Combine(".", "index.md"),
                    Path.Combine(".", "subdir1", "subdir2", "index.md")
                };

            // initialise the model (should fire events the same as addition)
            repository.Init(watcher, ".", Path.Combine(".", "somewikipath"), markdownFiles);
        }
Exemplo n.º 2
0
        public TestMasterRepository()
        {
            createdDirectories = new List <string>();
            updatedDirectories = new List <string>();
            deletedDirectories = new List <string>();
            movedDirectories   = new List <string>();

            createdPages = new List <string>();
            updatedPages = new List <string>();
            deletedPages = new List <string>();
            movedPages   = new List <string>();

            watcher    = new TestSourceWatcher();
            repository = new MasterRepository(".md");

            // setup event handlers
            repository.DirectoryAdded += (source, args) =>
            {
                createdDirectories.Add(args.SourcePath);
            };
            repository.DirectoryUpdated += (source, args) =>
            {
                updatedDirectories.Add(args.SourcePath);
            };
            repository.DirectoryDeleted += (source, args) =>
            {
                deletedDirectories.Add(args.SourcePath);
            };
            repository.DirectoryMoved += (source, args) => movedDirectories.Add(args.SourcePath);

            repository.PageAdded += (source, args) =>
            {
                createdPages.Add(args.SourcePath);
            };

            repository.PageUpdated += (source, args) =>
            {
                updatedPages.Add(args.SourcePath);
            };

            repository.PageDeleted += (source, args) =>
            {
                deletedPages.Add(args.SourcePath);
            };

            repository.PageMoved += (source, args) =>
            {
                movedPages.Add(args.SourcePath);
            };


            // create list of files
            IList <string> markdownFiles = new List <string>
            {
                Path.Combine(".", "index.md"),
                Path.Combine(".", "subdir1", "subdir2", "index.md")
            };

            // initialise the model (should fire events the same as addition)
            repository.Init(watcher, ".", Path.Combine(".", "somewikipath"), markdownFiles);
        }