Пример #1
0
        public void TestReadNonexistentProjectFile()
        {
            String testPrjFile = GetTestPrjFileName();
            var    xmlFilePersistenceConfig = new XmlFilePersistenceConfig(testPrjFile, GetTestContextFileName());

            System.IO.File.Delete(testPrjFile);
            Assert.IsFalse(System.IO.File.Exists(testPrjFile));

            var xp         = new XmlFilePersistence(xmlFilePersistenceConfig);
            var newPrjList = xp.LoadProjects();

            Assert.AreEqual(0, newPrjList.Count);
        }
Пример #2
0
        public void TestWriteProjectFile()
        {
            var xmlFilePersistenceConfig = new XmlFilePersistenceConfig(GetTestPrjFileName(), GetTestContextFileName());
            var xp      = new XmlFilePersistence(xmlFilePersistenceConfig);
            var prjList = new Collection <Project>();
            var prj     = new Project("Test Project 1");

            prjList.Add(prj);
            xp.SaveProjects(prjList);

            var newPrjList = xp.LoadProjects();

            Assert.AreEqual(1, newPrjList.Count);
            var newPrj = newPrjList[0];

            Assert.AreEqual("Test Project 1", newPrj.ProjectName);
        }