LongoMatch.DB.DataBase.RemoveProject C# (CSharp) Method

RemoveProject() public method

public RemoveProject ( System.Guid id ) : bool
id System.Guid
return bool
        public bool RemoveProject(Guid id)
        {
            string projectFile;

            Log.Debug (string.Format ("Remove project {0}", id));
            projectFile = Path.Combine (dbDirPath, id.ToString ());
            if (File.Exists (projectFile)) {
                File.Delete (projectFile);
            }
            return projectsDB.Delete (id);
        }

Usage Example

Esempio n. 1
0
 public void TestRemoveProject()
 {
     string dbdir = Path.Combine (tmpdir, "test.ldb");
     DataBase db = new DataBase (dbdir);
     ProjectDescriptionLongoMatch pd1 = new ProjectDescriptionLongoMatch ();
     ProjectLongoMatch p1 = new ProjectLongoMatch {Description = pd1};
     Assert.IsTrue (db.AddProject (p1));
     Assert.IsTrue (File.Exists (Path.Combine (dbdir, p1.ID.ToString())));
     Assert.AreEqual (db.Count, 1);
     Assert.IsTrue (db.RemoveProject (p1.ID));
     Assert.IsFalse (File.Exists (Path.Combine (dbdir, p1.ID.ToString())));
     Assert.AreEqual (db.Count, 0);
     Assert.IsFalse (db.RemoveProject (p1.ID));
     db = new DataBase (dbdir);
     Assert.AreEqual (db.Count, 0);
 }