/// <exception cref="System.IO.IOException"/> public virtual void TestCreateLocalTempFile() { SetupDirs(); FilePath baseFile = new FilePath(tmp, "base"); FilePath tmp1 = FileUtil.CreateLocalTempFile(baseFile, "foo", false); FilePath tmp2 = FileUtil.CreateLocalTempFile(baseFile, "foo", true); NUnit.Framework.Assert.IsFalse(tmp1.GetAbsolutePath().Equals(baseFile.GetAbsolutePath ())); NUnit.Framework.Assert.IsFalse(tmp2.GetAbsolutePath().Equals(baseFile.GetAbsolutePath ())); Assert.True(tmp1.Exists() && tmp2.Exists()); Assert.True(tmp1.CanWrite() && tmp2.CanWrite()); Assert.True(tmp1.CanRead() && tmp2.CanRead()); tmp1.Delete(); tmp2.Delete(); Assert.True(!tmp1.Exists() && !tmp2.Exists()); }
public virtual void Test002_WriteEmptyTree() { // One of our test packs contains the empty tree object. If the pack is // open when we create it we won't write the object file out as a loose // object (as it already exists in the pack). // Repository newdb = CreateBareRepository(); ObjectInserter oi = newdb.NewObjectInserter(); ObjectId treeId = oi.Insert(new TreeFormatter()); oi.Release(); NUnit.Framework.Assert.AreEqual("4b825dc642cb6eb9a060e54bf8d69288fbee4904", treeId .Name); FilePath o = new FilePath(new FilePath(new FilePath(newdb.Directory, "objects"), "4b"), "825dc642cb6eb9a060e54bf8d69288fbee4904"); NUnit.Framework.Assert.IsTrue(o.IsFile(), "Exists " + o); NUnit.Framework.Assert.IsTrue(!o.CanWrite(), "Read-only " + o); }