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);
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)); }
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); }
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()); }
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); }
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); }
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)); }
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)); }
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)); }
private string GetFileName() => Path.Combine(AppDataPathProvider.GetAppDataPath(), "appsettings.json");
public override string GetFileName() => Path.Combine(AppDataPathProvider.GetAppDataPath(), "RepositoryActions.json");
public override string GetFileName() => Path.Combine(AppDataPathProvider.GetAppDataPath(), "Repositories.ignore");