Exemple #1
0
        public void ReloadRegisteredServerDataTest_FileExists()
        {
            string fileName = string.Empty;

            string xmlFile = SqlBuildManager.Logging.Configure.AppDataPath + @"\RegisteredServers.xml";

            if (File.Exists(xmlFile))
            {
                File.Delete(xmlFile);
            }

            bool expected = false;
            bool actual;

            actual = RegisteredServerHelper.ReloadRegisteredServerData(fileName);
            Assert.AreEqual(expected, actual);
        }
        private void importRegisteredServerList_Click(object sender, EventArgs e)
        {
            if (sender is ToolStripMenuItem)
            {
                if (((ToolStripMenuItem)sender).Tag is RegisteredServerListFile)
                {
                    RegisteredServerListFile tmp = (RegisteredServerListFile)((ToolStripMenuItem)sender).Tag;

                    if (!RegisteredServerHelper.ReloadRegisteredServerData(Path.Combine(tmp.Path, tmp.FileName)))
                    {
                        MessageBox.Show("Unable to load the registered server list \"" + tmp.Description + "\" from " + tmp.Path + "\\" + tmp.FileName, "Can't load the file", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        PopulateRegisteredServerTree();
                    }
                }
            }
        }
Exemple #3
0
        public void ReloadRegisteredServerDataTest_GoodSaveAndLoad()
        {
            string fileName = Path.GetTempFileName();

            File.WriteAllText(fileName, Properties.Resources.RegisteredServers_Good);

            string xmlFile = SqlBuildManager.Logging.Configure.AppDataPath + @"\RegisteredServers.xml";

            if (File.Exists(xmlFile))
            {
                File.Delete(xmlFile);
            }

            bool expected = true;
            bool actual;

            actual = RegisteredServerHelper.ReloadRegisteredServerData(fileName);
            Assert.AreEqual(expected, actual);
            Assert.IsTrue(File.Exists(fileName));
        }