Exemple #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);
        }
Exemple #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);
        }
        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);
        }