gpt4 book ai didi

mocking - 为 System.Data 添加摩尔程序集失败

转载 作者:行者123 更新时间:2023-12-03 05:47:13 25 4
gpt4 key购买 nike

我在一个单元测试项目(VS 2010 单元测试)中使用 Microsoft Moles Framework (x86) 版本 0.94.51023.0。为了测试应用程序中的数据访问层方法,我尝试为 System.Data.dll 添加摩尔程序集,以便我可以模拟 SqlConnectionSqlCommand 对象。当我在添加摩尔组件时构建单元测试时,构建失败并显示以下错误详细信息

error CS0234: The type or namespace name 'SqlCredential' does not exist in the namespace 'System.Data.SqlClient'

error CS0234: The type or namespace name 'ApplicationIntent' does not exist in the namespace 'System.Data.SqlClient'

我的构建输出窗口末尾显示了以下内容:

error MSB3073: The command ""C:\Program Files (x86)\Microsoft Moles\bin\moles.exe" @...\UnitTests\obj\Debug\Moles\moles.args" exited with code -1002.

最佳答案

替换“C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.dll”中存在的“System.Data dll”后,该问题似乎已得到解决。 NETFramework\v4.0”,版本为“4.0.30319.17929”,在“C:\Windows\Microsoft.NET\Framework64\v4.0.30319 ”。看起来这个版本的 dll 中定义了 SqlCredential 类型,我能够成功地监视 System.Data dll

关于mocking - 为 System.Data 添加摩尔程序集失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15246418/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com