Exemplo n.º 1
0
 public void ImportShouldAddFilesToRepository()
 {
     Using.SvnRepo(url =>
     {
         Directory.CreateDirectory("trunk");
         var provider = new SvnProvider(log, TimeSpan.FromSeconds(30));
         provider.Import(".", url + "/test", "");
         Assert.That(provider.Exists(url + "/test/trunk"), log.Contents);
     });
 }
Exemplo n.º 2
0
        public void ShouldImportTrunkAndBranchIfTrunkDoesNotExist()
        {
            Using.Directory("publishSvn", () =>
            Using.SvnRepo(url => 
            {
                File.WriteAllText("test.txt", "");

                var log = new TestLogger();
                var sourceControl = new SvnProvider(log, TimeSpan.FromSeconds(30));
                var publish = new PublishToSourceControl(sourceControl);
                publish.FromWorkingDirectory(".")
                    .WithMainline(url + "/trunk")
                    .WithCommitMessage("test")
                    .To(url + "/tags/v1");

                Assert.That(sourceControl.Exists(url + "/trunk/test.txt"), "not imported into trunk\n" + log.Contents);
                Assert.That(sourceControl.Exists(url + "/tags/v1/test.txt"), "not branched\n" + log.Contents);
            }));
        }
Exemplo n.º 3
0
        public void ShouldUpdateTrunkAndBranchWhenFileDeleted()
        {
            Using.Directory("publishSvn", () =>
            Using.SvnRepo(url =>
            {
                var log = new TestLogger();
                var sourceControl = new SvnProvider(log, TimeSpan.FromSeconds(30));
                Directory.CreateDirectory("import");
                File.WriteAllText(@"import\test.txt", "");
                sourceControl.Import("import", url + "/trunk", "");

                Directory.CreateDirectory("new");

                var publish = new PublishToSourceControl(sourceControl);
                publish.FromWorkingDirectory("new")
                    .WithMainline(url + "/trunk")
                    .WithCommitMessage("test")
                    .To(url + "/tags/v1");

                Assert.That(!sourceControl.Exists(url + "/trunk/test.txt"), "file not deleted in trunk\n" + log.Contents);
                Assert.That(!sourceControl.Exists(url + "/tags/v1/test.txt"), "file not deleted in branch\n" + log.Contents);
            }));
        }
Exemplo n.º 4
0
        public void CommittingNewDirectoryShouldAddItToTheRepository()
        {
            Using.SvnRepo(url =>
            {
                var provider = new SvnProvider(log, TimeSpan.FromSeconds(30));
                provider.Import(".", url + "/test", "");

                provider.CreateWorkingDirectory(url + "/test", "workingDir");
                Directory.CreateDirectory(@"workingDir\trunk");
                provider.AddDirectory("trunk", "workingDir");
                provider.Commit("workingDir", "");

                Assert.That(provider.Exists(url + "/test/trunk"), log.Contents);
            });
        }
Exemplo n.º 5
0
        public void CommittingNewFileShouldAddItToTheRepository()
        {
            Using.SvnRepo(url =>
            {
                var provider = new SvnProvider(log, TimeSpan.FromSeconds(30));
                provider.Import(".", url + "/test", "");

                provider.CreateWorkingDirectory(url + "/test", "workingDir");
                File.WriteAllText(@"workingDir\test.txt", "");
                provider.AddFile("test.txt", "workingDir");
                provider.Commit("workingDir", "");

                Assert.That(provider.Exists(url + "/test/test.txt"), log.Contents);
            });
        }
Exemplo n.º 6
0
        public void CommittingDeletedDirectoryShouldRemoveItFromTheRepository()
        {
            Using.SvnRepo(url =>
            {
                Directory.CreateDirectory("test");
                var provider = new SvnProvider(log, TimeSpan.FromSeconds(30));
                provider.Import(".", url + "/test", "");

                provider.CreateWorkingDirectory(url + "/test", "workingDir");
                provider.DeleteDirectory("test", "workingDir");
                provider.Commit("workingDir", "");

                Assert.That(!provider.Exists(url + "/test/test"), log.Contents);
            });
        }
Exemplo n.º 7
0
        public void ImportingShouldCreateParentDirectories()
        {
            Using.SvnRepo(url =>
            {
                File.WriteAllText("test.txt", "");
                var provider = new SvnProvider(log, TimeSpan.FromSeconds(30));
                provider.Import(".", url + "/test/trunk", "");

                Assert.That(provider.Exists(url + "/test/trunk/test.txt"), log.Contents);
            });
        }
Exemplo n.º 8
0
        public void BranchingShouldCopyRepositoryToNewEndpoint()
        {
            Using.SvnRepo(url =>
            {
                File.WriteAllText("test.txt", "");
                var provider = new SvnProvider(log, TimeSpan.FromSeconds(30));
                provider.Import(".", url + "/test", "");

                provider.Branch(url + "/test", url + "/branch", "");

                Assert.That(provider.Exists(url + "/branch/test.txt"), log.Contents);
            });
        }