コード例 #1
0
ファイル: SvnCheckoutTest.cs プロジェクト: ddevening/Cake.Svn
        public void FixtureInit()
        {
            MockBuild buildEngine = new MockBuild();

            testDirectory = TaskUtility.makeTestDirectory(buildEngine);
            _context      = new Cake.VersionReader.Tests.Fakes.FakeCakeContext();
        }
コード例 #2
0
ファイル: SvnExportTest.cs プロジェクト: ddevening/Cake.Svn
        public void SvnExportLocal()
        {
            string        repoPath = "d:/svn/repo/Test";
            DirectoryInfo dirInfo  = new DirectoryInfo(repoPath);

            if (!dirInfo.Exists)
            {
                Assert.Ignore("Repository path '{0}' does not exist", repoPath);
            }

            string exportDir = Path.Combine(testDirectory, @"TestExport");

            if (Directory.Exists(exportDir))
            {
                Directory.Delete(exportDir, true);
            }
            var       context = new Cake.VersionReader.Tests.Fakes.FakeCakeContext();
            SvnExport export  = new SvnExport(context.CakeContext);

            export.BuildEngine = new MockBuild();

            Assert.IsNotNull(export);

            export.LocalPath      = exportDir;
            export.RepositoryPath = "file:///" + repoPath + "/trunk";
            bool result = export.Execute();

            Assert.IsTrue(result);
            Assert.IsTrue(export.Revision > 0);
        }
コード例 #3
0
ファイル: SvnExportTest.cs プロジェクト: ddevening/Cake.Svn
        public void SvnExportRemote()
        {
            string exportDir = Path.Combine(testDirectory, @"MSBuildTasksExport");

            if (Directory.Exists(exportDir))
            {
                Directory.Delete(exportDir, true);
            }


            var       context = new Cake.VersionReader.Tests.Fakes.FakeCakeContext();
            SvnExport export  = new SvnExport(context.CakeContext);

            export.BuildEngine = new MockBuild();

            Assert.IsNotNull(export);

            export.LocalPath      = exportDir;
            export.RepositoryPath =
                "http://msbuildtasks.tigris.org/svn/msbuildtasks/trunk/Source/MSBuild.Community.Tasks.Tests/Subversion";
            export.Username = "******";
            export.Password = "******";
            bool result = export.Execute();

            Assert.IsTrue(result);
            Assert.IsTrue(export.Revision > 0);
        }
コード例 #4
0
        public void ParsesStandardUpdateRevisionOutput()
        {
            _context = new Cake.VersionReader.Tests.Fakes.FakeCakeContext();
            SvnClientStub task = new SvnClientStub(_context.CakeContext);

            task.BuildEngine = new MockBuild();

            int actualRevision = task.GetRevisionFromLogEventsFromTextOutput("At revision 222", MessageImportance.Low);

            const int expectedRevision = 222;

            Assert.AreEqual(expectedRevision, actualRevision);
        }
コード例 #5
0
        public void SvnClientExecuteWithArguments()
        {
            _context = new Cake.VersionReader.Tests.Fakes.FakeCakeContext();
            SvnClient client = new SvnClient(_context.CakeContext);

            client.Command   = "diff";
            client.Arguments = "--non-interactive --no-auth-cache";

            string expectedCommand = "diff --non-interactive --no-auth-cache";
            string actualCommand   = TaskUtility.GetToolTaskCommand(client);

            Assert.AreEqual(expectedCommand, actualCommand);
        }
コード例 #6
0
        public void SvnUpdateCommand()
        {
            var       context   = new Cake.VersionReader.Tests.Fakes.FakeCakeContext();
            SvnUpdate task      = new SvnUpdate(context.CakeContext);
            string    localPath = @"c:\code";

            task.LocalPath = localPath;

            string expectedCommand = String.Format("update \"{0}\" --non-interactive --no-auth-cache", localPath);
            string actualCommand   = TaskUtility.GetToolTaskCommand(task);

            Assert.AreEqual(expectedCommand, actualCommand);
        }
コード例 #7
0
        public void SvnCopyExecute()
        {
            var     context = new Cake.VersionReader.Tests.Fakes.FakeCakeContext();
            SvnCopy task    = new SvnCopy(context.CakeContext);

            task.Message         = "Tagging";
            task.SourcePath      = "file:///d:/svn/trunk/path";
            task.DestinationPath = "file:///d:/svn/tags/release/path";
            string expectedCommand = "copy \"file:///d:/svn/trunk/path\" \"file:///d:/svn/tags/release/path\" --message \"Tagging\" --non-interactive --no-auth-cache";
            string actualCommand   = TaskUtility.GetToolTaskCommand(task);

            Assert.AreEqual(expectedCommand, actualCommand);
        }
コード例 #8
0
        public void TestInfoCommand()
        {
            var     context   = new Cake.VersionReader.Tests.Fakes.FakeCakeContext();
            SvnInfo info      = new SvnInfo(context.CakeContext);
            string  localPath = Path.Combine(TaskUtility.GetProjectRootDirectory(true), "Source");

            info.LocalPath = localPath;

            string expectedCommand = String.Format("info \"{0}\" --xml --non-interactive --no-auth-cache", localPath);
            string actualCommand   = TaskUtility.GetToolTaskCommand(info);

            Assert.AreEqual(expectedCommand, actualCommand);
        }
コード例 #9
0
ファイル: SvnCommitTest.cs プロジェクト: ddevening/Cake.Svn
        public void SvnCommitExecute()
        {
            var       context = new Cake.VersionReader.Tests.Fakes.FakeCakeContext().CakeContext;
            SvnCommit commit  = new SvnCommit(context);

            commit.Targets = new ITaskItem[] { new TaskItem("a.txt"), new TaskItem("b.txt") };
            commit.Message = "Test";
            string expectedCommand = "commit \"a.txt\" \"b.txt\" --message \"Test\" --non-interactive --no-auth-cache";
            string actualCommand   = TaskUtility.GetToolTaskCommand(commit);
            string actualCommand2  = TaskUtility.GetToolTaskToolPath(commit);

            Assert.AreEqual(expectedCommand, actualCommand);
        }
コード例 #10
0
        public void SvnClientExecute()
        {
            _context = new Cake.VersionReader.Tests.Fakes.FakeCakeContext();
            string    targetFile = "myfile.txt";
            SvnClient client     = new SvnClient(_context.CakeContext);

            client.Command = "revert";
            client.Targets = new ITaskItem[] { new TaskItem(targetFile) };

            string expectedCommand = String.Format("revert \"{0}\"", targetFile);
            string actualCommand   = TaskUtility.GetToolTaskCommand(client);

            Assert.AreEqual(expectedCommand, actualCommand);
        }
コード例 #11
0
        public void SvnVersionExecute()
        {
            var        context = new Cake.VersionReader.Tests.Fakes.FakeCakeContext();
            SvnVersion task    = new SvnVersion(context.CakeContext);

            task.BuildEngine = new MockBuild();

            string prjRootPath = TaskUtility.GetProjectRootDirectory(true);

            task.LocalPath = Path.Combine(prjRootPath, @"Source");

            Assert.IsTrue(task.Execute(), "Execute Failed");

            Assert.IsTrue(task.Revision > 0, "Invalid Revision Number");
        }
コード例 #12
0
        public void IgnoresSkippedPathsUpdateOutput()
        {
            _context = new Cake.VersionReader.Tests.Fakes.FakeCakeContext();
            SvnClientStub task = new SvnClientStub(_context.CakeContext);

            task.BuildEngine = new MockBuild();

            //  "Skipped paths..." is a potential output of svn.exe update and follows the actual revision output
            const string updateMsg = "Skipped paths: 1";

            int actualRevision = task.GetRevisionFromLogEventsFromTextOutput(updateMsg, MessageImportance.Low);

            const int expectedRevision = -1;

            Assert.AreEqual(expectedRevision, actualRevision);
        }
コード例 #13
0
        public void TestInfoReturnValues()
        {
            var     context = new Cake.VersionReader.Tests.Fakes.FakeCakeContext();
            SvnInfo info    = new SvnInfo(context.CakeContext);

            info.LocalPath   = Path.Combine(TaskUtility.GetProjectRootDirectory(true), "Source");
            info.BuildEngine = new MockBuild();
            Assert.IsTrue(info.Execute());

            string val = info.RepositoryPath;

            // "http://msbuildtasks.tigris.org/svn/msbuildtasks/trunk"
            // could also be svn://
            Assert.AreEqual(0, val.IndexOf("http://"));
            Assert.AreEqual(NodeKind.dir.ToString(), info.NodeKind);
            Assert.AreEqual("http://msbuildtasks.tigris.org/svn/msbuildtasks", info.RepositoryRoot);
            Assert.AreNotEqual(Guid.Empty, info.RepositoryUuid);
        }
コード例 #14
0
ファイル: SvnCheckoutTest.cs プロジェクト: ddevening/Cake.Svn
        public void SvnCheckoutRemote()
        {
            var         context  = new Cake.VersionReader.Tests.Fakes.FakeCakeContext();
            SvnCheckout checkout = new SvnCheckout(context.CakeContext);

            checkout.BuildEngine = new MockBuild();

            Assert.IsNotNull(checkout);

            checkout.LocalPath      = Path.Combine(testDirectory, @"MSBuildTasksCheckout");
            checkout.RepositoryPath =
                "http://msbuildtasks.tigris.org/svn/msbuildtasks/trunk/Source/MSBuild.Community.Tasks.Tests/Subversion";
            checkout.Username = "******";
            checkout.Password = "******";
            bool result = checkout.Execute();

            Assert.IsTrue(result);
            Assert.IsTrue(checkout.Revision > 0);
        }
コード例 #15
0
ファイル: SvnCheckoutTest.cs プロジェクト: ddevening/Cake.Svn
        public void SvnCheckoutRemoteCommandLine()
        {
            var         context    = new Cake.VersionReader.Tests.Fakes.FakeCakeContext();
            SvnCheckout checkout   = new SvnCheckout(context.CakeContext);
            string      localPath  = Path.Combine(testDirectory, @"MSBuildTasksCheckout");
            string      remotePath =
                "http://msbuildtasks.tigris.org/svn/msbuildtasks/trunk/Source/MSBuild.Community.Tasks.Tests/Subversion";

            checkout.LocalPath      = localPath;
            checkout.RepositoryPath = remotePath;
            checkout.Username       = "******";
            checkout.Password       = "******";

            string expectedCommand =
                String.Format(
                    "checkout \"{0}\" \"{1}\" --username guest --password guest1 --non-interactive --no-auth-cache",
                    remotePath, localPath);
            string actualCommand = TaskUtility.GetToolTaskCommand(checkout);

            Assert.AreEqual(expectedCommand, actualCommand);
        }
コード例 #16
0
ファイル: SvnCheckoutTest.cs プロジェクト: ddevening/Cake.Svn
        public void SvnCheckoutLocal()
        {
            string        repoPath = "e:/svn/repo/Test";
            DirectoryInfo dirInfo  = new DirectoryInfo(repoPath);

            if (!dirInfo.Exists)
            {
                Assert.Ignore("Repository path '{0}' does not exist", repoPath);
            }
            var         context  = new Cake.VersionReader.Tests.Fakes.FakeCakeContext();
            SvnCheckout checkout = new SvnCheckout(context.CakeContext);

            checkout.BuildEngine = new MockBuild();

            Assert.IsNotNull(checkout);

            checkout.LocalPath      = Path.Combine(testDirectory, @"TestCheckout");
            checkout.RepositoryPath = "file:///" + repoPath + "/trunk";
            bool result = checkout.Execute();

            Assert.IsTrue(result);
            Assert.IsTrue(checkout.Revision > 0);
        }