using System; using System.IO; using NUnit.Framework; using NAnt.Core.Tasks; using Tests.NAnt.Core; namespace Tests.NAnt.SourceControl.Tasks { /// /// Tests that the update task performs correctly and does /// not returen errors. /// [TestFixture] public class UpdateTaskTest : BuildTestBase { private static readonly String cvsTempPath = Path.Combine (Path.GetTempPath (), "cvscheckout-test"); private static readonly String TEST_FILE = Path.Combine (cvsTempPath, "nant/NAnt.build"); /// /// Project to checkout the file initially before /// the update test is done. /// private readonly String _checkoutXML = @" "; /// /// Project to update the working directory. /// private readonly String _projectXML = @" "; /// /// Run the checkout command so we have something to update. /// [SetUp] protected override void SetUp () { base.SetUp (); //System.Console.WriteLine (this.RunBuild (_checkoutXML)); } /// /// Test that a file deleted from the local working directory /// is retrieved from the cvs repository during an update. /// [Test] public void Test_CvsUpdate () { System.Console.WriteLine (_projectXML); // Delete the file. if (File.Exists (TEST_FILE)) { File.Delete (TEST_FILE); } // Make sure the file exists before we start the test. Assertion.Assert ("The master.build file was not where I expected it.", !File.Exists (TEST_FILE)); // Run the update to bring the file back down. String result = this.RunBuild (_projectXML); // Check that the file is back. Assertion.Assert ("File does not exist, update probably did not work.", File.Exists (TEST_FILE)); } /// /// Remove the directory created by the checkout/ update. /// [TearDown] protected override void TearDown () { base.TearDown (); //Directory.Delete (cvsTempPath, true); } } }