Exemplo n.º 1
0
        public void GetIntegrationPath_includes_filename()
        {
            Mock <IFilesystemIo> filesystem = GetFilesystemMock();
            var pathprovider = new AppDataPathProvider(filesystem.Object);

            //Act
            var returnedIntegrationPath = pathprovider.GetPathToIntegrationFile();

            //Assert
            Assert.AreEqual(@$ "{fullPathForIntegration}\{pathprovider.IntegrationFileName}", returnedIntegrationPath);
Exemplo n.º 2
0
        public void GetIntegrationPath_returns_correct_path()
        {
            Mock <IFilesystemIo> filesystem = GetFilesystemMock();
            var pathprovider = new AppDataPathProvider(filesystem.Object);

            //Act
            var returnedIntegrationPath = pathprovider.GetPathToIntegrationFile();

            //Assert
            Assert.IsTrue(returnedIntegrationPath.StartsWith(fullPathForIntegration));
        }
Exemplo n.º 3
0
        public void GetStorageBasePath_returns_correct_path()
        {
            Mock <IFilesystemIo> filesystem = GetFilesystemMock();
            var pathprovider = new AppDataPathProvider(filesystem.Object);

            //Act
            var returnedStoragePath = pathprovider.GetStorageBasePath();

            //Assert
            Assert.AreEqual(fullPathForStorage, returnedStoragePath);
        }
Exemplo n.º 4
0
        public void Throws_InvalidOperationException_if_appdata_folder_does_not_exist()
        {
            //Arrange
            var filesystem   = GetFilesystemMock(appDataPath: string.Empty);
            var pathprovider = new AppDataPathProvider(filesystem.Object);

            //Act &&
            //Assert
            Assert.ThrowsException <InvalidOperationException>(() => _ = pathprovider.GetStorageBasePath());
            Assert.ThrowsException <InvalidOperationException>(() => _ = pathprovider.GetPathToIntegrationFile());
        }
Exemplo n.º 5
0
        public void IntegrationPath_creates_the_directory()
        {
            //Arrange
            var filesystem   = GetFilesystemMock();
            var pathprovider = new AppDataPathProvider(filesystem.Object);

            //Act
            _ = pathprovider.GetPathToIntegrationFile();

            //Assert
            filesystem.Verify(mock => mock.CreateDirectory(fullPathForIntegration), Times.Once);
        }
Exemplo n.º 6
0
        public void GetStorageBasePath_creates_the_directory()
        {
            //Arrange
            var filesystem   = GetFilesystemMock();
            var pathprovider = new AppDataPathProvider(filesystem.Object);

            //Act
            _ = pathprovider.GetStorageBasePath();

            //Assert
            filesystem.Verify(mock => mock.CreateDirectory(fullPathForStorage), Times.Once);
        }
Exemplo n.º 7
0
        private bool TryCopyDefaultJsonFile()
        {
            var defaultFile = Path.Combine(AppDataPathProvider.GetAppResourcesPath(), "RepositoryActions.json");
            var targetFile  = GetFileName();

            try
            {
                File.Copy(defaultFile, targetFile);
            }
            catch { /* lets ignore errors here, we just want to know if if worked or not by checking the file existence */ }

            return(File.Exists(targetFile));
        }
Exemplo n.º 8
0
        public void GetStorageBasePath_gets_and_uses_the_AppData_path()
        {
            //Arrange
            var filesystem   = GetFilesystemMock();
            var pathprovider = new AppDataPathProvider(filesystem.Object);

            //Act
            var returnedPath = pathprovider.GetStorageBasePath();

            //Assert
            filesystem.Verify(mock => mock.GetFolderPath(Environment.SpecialFolder.ApplicationData));
            Assert.IsTrue(returnedPath.StartsWith(AppDataPath));
        }
Exemplo n.º 9
0
        public void Adds_bkhedblom_StoryBuckets_to_the_appdata_path()
        {
            //Arrange
            var filesystem   = GetFilesystemMock();
            var pathprovider = new AppDataPathProvider(filesystem.Object);

            //Act
            var returnedStoragePath     = pathprovider.GetStorageBasePath();
            var returnedIntegrationPath = pathprovider.GetPathToIntegrationFile();

            //Assert
            Assert.IsTrue(returnedStoragePath.StartsWith(appDataForStoryBuckets));
            Assert.IsTrue(returnedIntegrationPath.StartsWith(appDataForStoryBuckets));
        }
Exemplo n.º 10
0
 private string GetFileName() => Path.Combine(AppDataPathProvider.GetAppDataPath(), "appsettings.json");
Exemplo n.º 11
0
 public override string GetFileName() => Path.Combine(AppDataPathProvider.GetAppDataPath(), "RepositoryActions.json");
Exemplo n.º 12
0
 public override string GetFileName() => Path.Combine(AppDataPathProvider.GetAppDataPath(), "Repositories.ignore");