Skip to content

Instantly share code, notes, and snippets.

@jamesrcounts
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesrcounts/24eda76fa076bc8b09fd to your computer and use it in GitHub Desktop.
Save jamesrcounts/24eda76fa076bc8b09fd to your computer and use it in GitHub Desktop.
Approve app.config
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