예제 #1
0
        public FileSystemBase()
        {
            string testFolder = Path.Join(AppDomain.CurrentDomain.BaseDirectory, this.GetType().Name);

            if (Directory.Exists(testFolder))
            {
                Directory.Delete(testFolder, true);
            }

            Directory.CreateDirectory(testFolder);


            Settings = new TetriSettings(new TestLogger <TetriSettings>())
            {
                RepositoryPath = Path.Join(testFolder, "repository"),
                PackagePath    = Path.Join(testFolder, "packages"),
                TempPath       = Path.Join(testFolder, "temp"),
                ArchivePath    = Path.Join(testFolder, "archives"),
                TagsPath       = Path.Join(testFolder, "tags")
            };

            Logger     = new TestLogger <IIndexReader>();
            TagService = new Core.TagsService(
                Settings,
                new TestLogger <ITagsService>(), new PackageListCache(MemoryCacheHelper.GetInstance()));

            IndexReader = new Core.IndexReader(Settings, new Core.ThreadDefault(), TagService, Logger, new FileSystem(), HashServiceHelper.Instance());
            Thread.Sleep(200);// fixes race condition when scaffolding up index between consecutive tests
            IndexReader.Initialize();
        }