public void TestAddProject() { 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.IsTrue (db.AddProject (p1)); Assert.AreEqual (db.Count, 1); db = new DataBase (dbdir); Assert.AreEqual (db.Count, 1); }
public void TestExists() { string dbdir = Path.Combine(tmpdir, "test.ldb"); DataBase db = new DataBase(dbdir); ProjectDescriptionLongoMatch pd1 = new ProjectDescriptionLongoMatch(); ProjectLongoMatch p1 = new ProjectLongoMatch { Description = pd1 }; Assert.IsFalse(db.Exists(p1)); db.AddProject(p1); Assert.IsTrue(db.Exists(p1)); }
public void TestUpdateProject() { string dbdir = Path.Combine(tmpdir, "test.ldb"); DataBase db = new DataBase(dbdir); ProjectDescriptionLongoMatch pd1 = new ProjectDescriptionLongoMatch(); ProjectLongoMatch p1 = new ProjectLongoMatch { Description = pd1 }; DateTime lastModified = p1.Description.LastModified; Assert.IsTrue(db.AddProject(p1)); Assert.IsTrue(db.UpdateProject(p1)); Assert.AreNotEqual(p1.Description.LastModified, lastModified); }
public void TestGetProject() { string dbdir = Path.Combine(tmpdir, "test.ldb"); DataBase db = new DataBase(dbdir); ProjectDescriptionLongoMatch pd1 = new ProjectDescriptionLongoMatch(); ProjectLongoMatch p1 = new ProjectLongoMatch { Description = pd1 }; db.AddProject(p1); ProjectLongoMatch p2 = db.GetProject(p1.ID); Assert.AreEqual(p1.ID, p2.ID); Assert.IsNull(db.GetProject(new Guid())); }
public void TestAddProject() { 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.IsTrue(db.AddProject(p1)); Assert.AreEqual(db.Count, 1); db = new DataBase(dbdir); Assert.AreEqual(db.Count, 1); }
public void TestGetAllProjects() { string dbdir = Path.Combine(tmpdir, "test.ldb"); DataBase db = new DataBase(dbdir); ProjectDescriptionLongoMatch pd1 = new ProjectDescriptionLongoMatch(); ProjectDescriptionLongoMatch pd2 = new ProjectDescriptionLongoMatch(); ProjectLongoMatch p1 = new ProjectLongoMatch { Description = pd1 }; ProjectLongoMatch p2 = new ProjectLongoMatch { Description = pd2 }; db.AddProject(p1); db.AddProject(p2); Assert.AreEqual(db.Count, 2); List <ProjectDescriptionLongoMatch> projects = db.GetAllProjects(); Assert.AreEqual(db.Count, 2); Assert.AreEqual(projects.Count, 2); Assert.AreEqual(projects[0], pd1); Assert.AreEqual(projects[1], pd2); }
public void TestUpdateProject() { string dbdir = Path.Combine (tmpdir, "test.ldb"); DataBase db = new DataBase (dbdir); ProjectDescriptionLongoMatch pd1 = new ProjectDescriptionLongoMatch (); ProjectLongoMatch p1 = new ProjectLongoMatch {Description = pd1}; DateTime lastModified = p1.Description.LastModified; Assert.IsTrue (db.AddProject (p1)); Assert.IsTrue (db.UpdateProject (p1)); Assert.AreNotEqual (p1.Description.LastModified, lastModified); }
public void TestGetProject() { string dbdir = Path.Combine (tmpdir, "test.ldb"); DataBase db = new DataBase (dbdir); ProjectDescriptionLongoMatch pd1 = new ProjectDescriptionLongoMatch (); ProjectLongoMatch p1 = new ProjectLongoMatch {Description = pd1}; db.AddProject (p1); ProjectLongoMatch p2 = db.GetProject (p1.ID); Assert.AreEqual (p1.ID, p2.ID); Assert.IsNull (db.GetProject (new Guid())); }
public void TestGetAllProjects() { string dbdir = Path.Combine (tmpdir, "test.ldb"); DataBase db = new DataBase (dbdir); ProjectDescriptionLongoMatch pd1 = new ProjectDescriptionLongoMatch (); ProjectDescriptionLongoMatch pd2 = new ProjectDescriptionLongoMatch (); ProjectLongoMatch p1 = new ProjectLongoMatch {Description = pd1}; ProjectLongoMatch p2 = new ProjectLongoMatch {Description = pd2}; db.AddProject (p1); db.AddProject (p2); Assert.AreEqual (db.Count, 2); List<ProjectDescriptionLongoMatch> projects = db.GetAllProjects (); Assert.AreEqual (db.Count, 2); Assert.AreEqual (projects.Count, 2); Assert.AreEqual (projects[0], pd1); Assert.AreEqual (projects[1], pd2); }
public void TestExists() { string dbdir = Path.Combine (tmpdir, "test.ldb"); DataBase db = new DataBase (dbdir); ProjectDescriptionLongoMatch pd1 = new ProjectDescriptionLongoMatch (); ProjectLongoMatch p1 = new ProjectLongoMatch {Description = pd1}; Assert.IsFalse (db.Exists (p1)); db.AddProject (p1); Assert.IsTrue (db.Exists (p1)); }