コード例 #1
0
        public void save_saves_to_disk()
        {
            string oldServername, newServername = "newServerName",
                   oldDbname, newDbname = "newDbName";

            _server       = new server(constantinople.XML_FILEPATH);
            oldServername = _server.Name; // this could be null or empty
            oldDbname     = _server.Db;   // this could be null or empty

            _server = new server(constantinople.XML_FILEPATH, name: newServername, db: newDbname);

            _server.save();

            // reload
            _server = new server(constantinople.XML_FILEPATH);
            // if this has gone wrong then the setting on the XML file have been lost forever

            Assert.AreEqual(newServername, _server.Name);
            Assert.AreEqual(newDbname, _server.Db);

            // normalise - if possible
            _server = new server(constantinople.XML_FILEPATH, name: oldServername, db: oldDbname);
            _server.save();
        }