Example #1
0
        public async Task CopyRepository_TargetExistsLocally_InitialCloneMoved()
        {
            // Arrange
            string developer        = "testUser";
            string org              = "ttd";
            string sourceRepository = "apps-test";
            string targetRepository = "apps-test-2021";

            try
            {
                PrepareRemoteTestData(org, sourceRepository);
                TestDataHelper.CleanUpRemoteRepository("ttd", "apps-test-2021");
                await TestDataHelper.CleanUpReplacedRepositories(org, targetRepository, developer);

                RepositorySI sut = GetServiceForTest(developer);

                // Act
                await sut.CopyRepository(org, sourceRepository, targetRepository, developer);

                // Assert
                string developerClonePath = Path.Combine(TestDataHelper.GetTestDataRepositoriesRootDirectory(), developer, org);
                int    actualCloneCount   = Directory.GetDirectories(developerClonePath).Count(d => d.Contains("apps-test-2021"));
                Assert.Equal(2, actualCloneCount);
            }
            finally
            {
                TestDataHelper.CleanUpRemoteRepository("ttd", "apps-test-2021");
                await TestDataHelper.CleanUpReplacedRepositories(org, targetRepository, developer);

                CleanUpRemoteTestData(org, sourceRepository);
            }
        }