0

当我在我的 Unittest 中使用 Moles 时,无法使用 configurationManager 从 appconfig 中获取值。

我知道这是一个已知问题,但我想知道除了使用以下解决方案 http://social.msdn.microsoft.com/Forums/en/pex/thread伪造之外,是否可以找到好的解决方法(一些技巧)来解决这个问题/9b4b9ec5-582c-41e8-8b9c-1bb9457ba3f6

谢谢!!!

4

1 回答 1

0

我使用的一个相对简单的选项是在测试中的代码中添加设置:

ConfigurationManager.AppSettings["FolderPathInConfig"] = 
            Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestData");
于 2011-06-30T17:38:31.333 回答