예제 #1
0
        private void OnApplicationExit(object sender, EventArgs e)
        {
            // Remove custom DNS settings.
            _dnsManager.SetDNS();

            // Restore the original file before exiting.
            _fileUpdater.RestoreTargetFile(_appSetting.HostFilePath);
        }
예제 #2
0
        public void FileUpdateUnitTests_RestoreTargetFile()
        {
            string testFile = DirtyHostFilePath + ".test";

            File.Copy(DirtyHostFilePath, testFile);

            bool result  = _fileUpdater.RestoreTargetFile(testFile);
            var  content = File.ReadAllText(testFile);

            Assert.IsTrue(result);
            Assert.IsTrue(!content.Contains("hostname6"));

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