Ejemplo n.º 1
0
        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);
            }

            SvnExport export = new SvnExport();

            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);
        }
Ejemplo n.º 2
0
        public void SvnExportRemote()
        {
            string exportDir = Path.Combine(testDirectory, @"MSBuildTasksExport");

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

            SvnExport export = new SvnExport();

            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);
        }
Ejemplo n.º 3
0
        public static SvnResultsBase SvnExport(this ICakeContext context,
                                               string repositorypath,
                                               string localPath,
                                               bool force,
                                               string username,
                                               string password)
        {
            SvnResultsBase results = new SvnResultsBase();
            SvnExport      task    = new SvnExport(context)
            {
                Username       = username,
                Password       = password,
                RepositoryPath = repositorypath,
                LocalPath      = localPath,
                Force          = force
            };

            string actualCommand  = GetToolTaskCommand(task);
            string actualCommand2 = GetToolTaskToolPath(task);

            var bOk = task.Execute();

            if (task.ExitCode != 0)
            {
                //-- fail
            }
            results.RepositoryPath = task.RepositoryPath ?? "";
            results.Revision       = task.Revision;
            results.StandardOutput = task.StandardOutput ?? "";
            results.StandardError  = task.StandardError ?? "";
            results.ExitCode       = task.ExitCode;

            return(results);
        }
        public void TestExportURL()
        {
            MockRepository repository = new MockRepository();
            IBuildEngine engine = repository.StrictMock<IBuildEngine>();

            string path = string.Format(RepositoryPathTemplate, DateTime.Now.Ticks);

            SvnExport task = new SvnExport();
            task.BuildEngine = engine;
            task.RepositoryPath = RepositoryURL;
            task.Username = "******";
            task.DestinationPath = path;

            bool success = task.Execute();

            Assert.That(success, Is.True);
        }
Ejemplo n.º 5
0
        public void SvnExportRemoteCommand()
        {
            string exportDir  = Path.Combine(testDirectory, @"MSBuildTasksExport");
            string remotePath =
                "http://msbuildtasks.tigris.org/svn/msbuildtasks/trunk/Source/MSBuild.Community.Tasks.Tests/Subversion";

            SvnExport export = new SvnExport();

            export.LocalPath      = exportDir;
            export.RepositoryPath = remotePath;
            export.Username       = "******";
            export.Password       = "******";

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

            Assert.AreEqual(expectedCommand, actualCommand);
        }