Example #1
0
        public void Setup()
        {
            _localAppDataFolder = $"{_localDataFolder}DWGitsh";

            _fileManager      = Substitute.For <IFile>();
            _diskManager      = Substitute.For <IStaticAbstraction>();
            _diskManager.File = _fileManager;
            _diskManager.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData).Returns(_localDataFolder);
            _diskManager.Path.Combine(_localDataFolder, "DWGitsh").Returns(_localAppDataFolder);
            _diskManager.Directory.Exists(_localAppDataFolder).Returns(true);

            _diskManager.NewDirectoryInfo(_localAppDataFolder).Returns(new MockDirectoryInfo {
                FullName = _localAppDataFolder, Name = "DWGitsh"
            });

            _config = Substitute.For <IDWGitshConfig>();
            _config.AppDataFolder.Returns(_localAppDataFolder);

            _repoPaths = Substitute.For <IRepositoryPaths>();
            _repoPaths.RootFolder.Returns("C:\\Junk\\Folder\\");
            _repoPaths.RepositoryFolder.Returns("C:\\Junk\\Folder\\.git\\");

            _hitRepo = Substitute.For <IHitDataRepo>();
            _manager = new HitDataManager(_config, _diskManager, _repoPaths, null, _hitRepo);

            _hitRepo.Load().Returns(new CommandData());
        }
Example #2
0
        public HitDataManager(IDWGitshConfig config, IStaticAbstraction diskManager, IRepositoryPaths repoDirs, IGitUtils utils = null, IHitDataRepo hitRepo = null)
        {
            _utils                     = utils ?? GitUtils.Current;
            this._diskManager          = diskManager ?? new StAbWrapper();
            this.RepositoryDirectories = repoDirs;

            _hitDataRepo = hitRepo ?? new HitDataRepo(config.AppDataFolder, _diskManager);
        }
Example #3
0
        public void Setup()
        {
            _localAppDataHitsFile = $"{_dataPath}\\hitData.json";

            _fileManager      = Substitute.For <IFile>();
            _diskManager      = Substitute.For <IStaticAbstraction>();
            _diskManager.File = _fileManager;

            _diskManager.Path.Combine(_dataPath, "hitData.json").Returns(_localAppDataHitsFile);

            _repo = new HitDataRepo(_dataPath, _diskManager);
        }