protected void SetUp() { mockHistoryParser = new DynamicMock(typeof (IHistoryParser)); mockFileSystem = new DynamicMock(typeof (IFileSystem)); mockFileDirectoryDeleter = new DynamicMock(typeof (IFileDirectoryDeleter)); CreateProcessExecutorMock(Mercurial.DefaultExecutable); from = new DateTime(2001, 1, 21, 20, 0, 0); to = from.AddDays(1); tempWorkDir = TempFileUtil.CreateTempDir("ccnet-hg-test"); tempHgDir = Path.Combine(TempFileUtil.CreateTempDir("ccnet-hg-test"), ".hg"); Directory.CreateDirectory(tempHgDir); outputTemplate = Path.Combine(tempHgDir, "ccnet.template"); hg = new Mercurial((IHistoryParser) mockHistoryParser.MockInstance, (ProcessExecutor) mockProcessExecutor.MockInstance, new StubFileSystem(), new StubFileDirectoryDeleter()); hg.WorkingDirectory = tempWorkDir; }
public void PopulateFromMinimallySpecifiedXml() { hg = (CruiseControl.Core.Sourcecontrol.Mercurial.Mercurial) NetReflector.Read(ConfigMin); Assert.That(hg.AutoGetSource, Is.True); Assert.That(hg.Branch, Is.Null.Or.Empty); Assert.That(hg.CommitModifications, Is.False); Assert.That(hg.CommitterName, Is.EqualTo("CruiseControl.NET")); Assert.That(hg.CommitUntracked, Is.False); Assert.That(hg.Executable, Is.EqualTo("hg")); Assert.That(hg.MultipleHeadsFail, Is.False); Assert.That(hg.ModificationsCommitMessage, Is.EqualTo("Modifications of CC.NET build {0}")); Assert.That(hg.PurgeModifications, Is.False); Assert.That(hg.PushModifications, Is.False); Assert.That(hg.Repository, Is.Null.Or.Empty); Assert.That(hg.TagCommitMessage, Is.EqualTo("Tagging CC.NET build {0}")); Assert.That(hg.TagNameFormat, Is.EqualTo("ccnet_build_{0}")); Assert.That(hg.TagOnSuccess, Is.False); }
public void ShouldCreateWorkingDirectoryIfItDoesntExistOrIsNotARepository() { hg = new Mercurial((IHistoryParser) mockHistoryParser.MockInstance, (ProcessExecutor) mockProcessExecutor.MockInstance, (IFileSystem) mockFileSystem.MockInstance, (IFileDirectoryDeleter) mockFileDirectoryDeleter.MockInstance); hg.WorkingDirectory = tempWorkDir; hg.Repository = @"C:\foo"; mockFileSystem.Expect("EnsureFolderExists", tempWorkDir); mockFileSystem.Expect("EnsureFolderExists", tempHgDir); mockFileSystem.ExpectAndReturn("DirectoryExists", true, tempWorkDir); mockFileSystem.ExpectAndReturn("DirectoryExists", false, tempHgDir); mockFileDirectoryDeleter.Expect("DeleteIncludingReadOnlyObjects", new object[] { tempWorkDir }); mockFileSystem.ExpectAndReturn("DirectoryExists", false, tempWorkDir); ExpectToExecuteArguments(@"init " + StringUtil.AutoDoubleQuoteString(tempWorkDir), Directory.GetParent(Path.GetFullPath(tempWorkDir)).FullName); ExpectToExecuteArguments(@"pull C:\foo", tempWorkDir); hg.GetModifications(IntegrationResult(from), IntegrationResult(to)); }
public void PopulateFromFullySpecifiedXml() { hg = (CruiseControl.Core.Sourcecontrol.Mercurial.Mercurial) NetReflector.Read(ConfigFull); Assert.That(hg.AutoGetSource, Is.True); Assert.That(hg.Branch, Is.EqualTo("trunk")); Assert.That(hg.CommitModifications, Is.True); Assert.That(hg.CommitterName, Is.EqualTo("CCNet")); Assert.That(hg.CommitUntracked, Is.True); Assert.That(hg.Executable, Is.EqualTo(@"c:\Python25\Scripts\hg.bat")); Assert.That(hg.MultipleHeadsFail, Is.False); Assert.That(hg.ModificationsCommitMessage, Is.EqualTo("Modifications for build {0}")); Assert.That(hg.PurgeModifications, Is.True); Assert.That(hg.PushModifications, Is.True); Assert.That(hg.Repository, Is.EqualTo(@"c:\hg\ccnet\myhgrepo")); Assert.That(hg.TagCommitMessage, Is.EqualTo("Tag for build {0}")); Assert.That(hg.TagNameFormat, Is.EqualTo("tag_{0}")); Assert.That(hg.TagOnSuccess, Is.True); }