public void TestReadNonexistentProjectFile() { String testPrjFile = GetTestPrjFileName(); var binFilePersistenceConfig = new BinFilePersistenceConfig(testPrjFile, GetTestContextFileName()); System.IO.File.Delete(testPrjFile); Assert.IsFalse(System.IO.File.Exists(testPrjFile)); var fp = new BinFilePersistence(binFilePersistenceConfig); var newPrjList = fp.LoadProjects(); Assert.AreEqual(0, newPrjList.Count); }
public void TestWriteProjectFile() { var binFilePersistenceConfig = new BinFilePersistenceConfig(GetTestPrjFileName(), GetTestContextFileName()); var fp = new BinFilePersistence(binFilePersistenceConfig); var prjList = new Collection <Project>(); var prj = new Project("Test Project 1"); prjList.Add(prj); fp.SaveProjects(prjList); var newPrjList = fp.LoadProjects(); Assert.AreEqual(1, newPrjList.Count); var newPrj = newPrjList[0]; Assert.AreEqual("Test Project 1", newPrj.ProjectName); }
public void TestCreateFile() { String prfTestFile = GetTestPrjFileName(); String ctxTestFile = GetTestContextFileName(); var binFilePersistenceConfig = new BinFilePersistenceConfig(prfTestFile, ctxTestFile); System.IO.File.Delete(prfTestFile); System.IO.File.Delete(ctxTestFile); Assert.IsFalse(System.IO.File.Exists(prfTestFile)); Assert.IsFalse(System.IO.File.Exists(ctxTestFile)); var fp = new BinFilePersistence(binFilePersistenceConfig); fp.CreateProjectFile(); fp.CreateContextFile(); Assert.IsTrue(System.IO.File.Exists(prfTestFile), "Cannot find Project file!"); Assert.IsTrue(System.IO.File.Exists(ctxTestFile), "Cannot find Context file!"); }