Beispiel #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);
     });
 }
Beispiel #2
0
        public void CreateWorkingDirectoryShouldPerformACheckout()
        {
            Using.SvnRepo(url =>
            {
                var provider = new SvnProvider(log, TimeSpan.FromSeconds(30));
                Directory.CreateDirectory("trunk");
                provider.Import(".", url + "/test", "");

                provider.CreateWorkingDirectory(url + "/test", "workingDir");
                Assert.That(Directory.Exists(@"workingDir\trunk"), log.Contents);
            });
        }
Beispiel #3
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);
            });
        }
Beispiel #4
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);
            }));
        }
Beispiel #5
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);
            }));
        }
Beispiel #6
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);
            });
        }
Beispiel #7
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);
            });
        }
Beispiel #8
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);
            });
        }
Beispiel #9
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);
            });
        }
Beispiel #10
0
        public void CommittingUpdatedFileShouldChangeItInTheRepository()
        {
            Using.SvnRepo(url =>
            {
                File.WriteAllText("test.txt", "");
                var provider = new SvnProvider(log, TimeSpan.FromSeconds(30));
                provider.Import(".", url + "/test", "");

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

                Assert.That(File.ReadAllText(@"validationDir\test.txt"), Is.EqualTo("update"), log.Contents);
            });
        }