Last active
August 29, 2015 14:07
-
-
Save jamesrcounts/24eda76fa076bc8b09fd to your computer and use it in GitHub Desktop.
Approve app.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void VerifyConfig(string path, Action<Configuration> action) | |
{ | |
using (var t = new TempFile(Path.GetRandomFileName())) | |
{ | |
File.Copy(path, t.File.FullName, true); | |
var fileMap = new ExeConfigurationFileMap { ExeConfigFilename = t.File.FullName }; | |
var exeConfig = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); | |
action.Invoke(exeConfig); | |
var config = File.ReadAllText(exeConfig.FilePath); | |
Approvals.Verify(config); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment