public void CleanUp()
 {
     while (_disposables.TryPop(out var disposable))
     {
         disposable.Dispose();
     }
     DeleteHelper.DeleteDirectory(_baseDirectory);
 }
        protected override void SetUp()
        {
            var directoryPath = Path.Combine(TestConfig.DirectoryPath(), "databustest");

            DeleteHelper.DeleteDirectory(directoryPath);

            _storage = new FileSystemDataBusStorage(directoryPath, new ConsoleLoggerFactory(false));
            _storage.Initialize();
        }
Beispiel #3
0
        public static async Task RemoveProject(string companyName, MicroServiceEntity entity)
        {
            var path = await GoFilePaths.GetProjectPath(companyName, entity.Name);

            if (Directory.Exists(path))
            {
                DeleteHelper.DeleteDirectory(path);
            }
        }
Beispiel #4
0
        static void CleanUpDirectory()
        {
            if (!Directory.Exists(DirectoryPath))
            {
                return;
            }

            Console.WriteLine($"Removing directory '{DirectoryPath}'");

            DeleteHelper.DeleteDirectory(DirectoryPath);
        }
Beispiel #5
0
        protected string NewTempDirectory()
        {
            var directoryPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Guid.NewGuid().ToString("N"));

            Console.WriteLine($"Creating temp directory '{directoryPath}'");
            Directory.CreateDirectory(directoryPath);

            Using(new DisposableCallback(() =>
            {
                Console.WriteLine($"Deleting temp directory '{directoryPath}'");
                DeleteHelper.DeleteDirectory(directoryPath);
            }));

            return(directoryPath);
        }
        public void PicksAnotherDirectoryNameWhenDynamicRepoFolderTaken()
        {
            var repoName = Guid.NewGuid().ToString();
            var tempPath = Path.GetTempPath();
            var tempDir  = Path.Combine(tempPath, repoName);

            Directory.CreateDirectory(tempDir);
            string expectedDynamicRepoLocation = null;

            try
            {
                using (var fixture = new EmptyRepositoryFixture())
                {
                    fixture.Repository.CreateFileAndCommit("TestFile.txt");
                    File.Copy(Path.Combine(fixture.RepositoryPath, "TestFile.txt"), Path.Combine(tempDir, "TestFile.txt"));
                    expectedDynamicRepoLocation = Path.Combine(tempPath, fixture.RepositoryPath.Split(Path.DirectorySeparatorChar).Last());
                    Directory.CreateDirectory(expectedDynamicRepoLocation);

                    var repositoryInfo = new RepositoryInfo
                    {
                        Url    = fixture.RepositoryPath,
                        Branch = "master"
                    };

                    using (var gitRepository = GitRepositoryFactory.CreateRepository(repositoryInfo))
                    {
                        gitRepository.IsDynamic.ShouldBe(true);
                        gitRepository.DotGitDirectory.ShouldBe(Path.Combine(expectedDynamicRepoLocation + "_1", ".git"));
                    }
                }
            }
            finally
            {
                DeleteHelper.DeleteDirectory(tempDir, true);
                if (expectedDynamicRepoLocation != null)
                {
                    DeleteHelper.DeleteDirectory(expectedDynamicRepoLocation, true);
                }

                if (expectedDynamicRepoLocation != null)
                {
                    DeleteHelper.DeleteGitRepository(expectedDynamicRepoLocation + "_1");
                }
            }
        }
        public void PicksAnotherDirectoryNameWhenDynamicRepoFolderIsInUse()
        {
            var tempPath = Path.GetTempPath();
            var expectedDynamicRepoLocation  = default(string);
            var expectedDynamicRepo2Location = default(string);

            try
            {
                using (var fixture = new EmptyRepositoryFixture())
                {
                    var head           = fixture.Repository.CreateFileAndCommit("TestFile.txt");
                    var repositoryInfo = new RepositoryInfo
                    {
                        Url = fixture.RepositoryPath
                    };

                    using (var dynamicRepository = DynamicRepositories.CreateOrOpen(repositoryInfo, tempPath, "master", head.Sha))
                        using (var dynamicRepository2 = DynamicRepositories.CreateOrOpen(repositoryInfo, tempPath, "master", head.Sha))
                        {
                            expectedDynamicRepoLocation  = dynamicRepository.Repository.Info.Path;
                            expectedDynamicRepo2Location = dynamicRepository2.Repository.Info.Path;
                            dynamicRepository.Repository.Info.Path.ShouldNotBe(dynamicRepository2.Repository.Info.Path);
                        }
                }
            }
            finally
            {
                if (expectedDynamicRepoLocation != null)
                {
                    DeleteHelper.DeleteDirectory(expectedDynamicRepoLocation, true);
                }

                if (expectedDynamicRepo2Location != null)
                {
                    DeleteHelper.DeleteGitRepository(expectedDynamicRepo2Location);
                }
            }
        }
Beispiel #8
0
 public void Cleanup()
 {
     DeleteHelper.DeleteDirectory(_basePath);
 }
 public void CleanUp()
 {
     DeleteHelper.DeleteDirectory(_baseDirectory);
 }