Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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());
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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));
        }
Ejemplo n.º 5
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));
        }