Ejemplo n.º 1
0
        private void OnSetHostFileMenuClicked(object sender, EventArgs e)
        {
            var menu = sender as ToolStripMenuItem;

#if DEBUG
            Debug.WriteLine($"Updating host file to {menu.Text}...");
#endif
            _fileUpdater.UpdateTargetFile(menu.Text, _appSetting.HostFilePath);

            UpdateNotifyIconText();
#if DEBUG
            Debug.WriteLine("Host file update finished.");
#endif
        }
Ejemplo n.º 2
0
        public void FileUpdateUnitTests_UpdateTargetFile()
        {
            string testFile       = CleanHostFilePath + ".test";
            string backupTestFile = testFile + ".bak";

            File.Copy(CleanHostFilePath, testFile, true);

            _fileUpdater.UpdateTargetFile(EnvironmentName, testFile);

            Assert.IsTrue(File.Exists(backupTestFile));

            // Clean up.
            File.Delete(testFile);
            File.Delete(backupTestFile);
        }