gpt4 book ai didi

unit-testing - MS 测试 "Method not found: System.String"错误

转载 作者:行者123 更新时间:2023-12-04 04:50:03 24 4
gpt4 key购买 nike

最近我的一些 MS Test 单元测试已经停止工作。我在测试中没有改变任何东西。我得到的错误如下:

Test Failed - [file name]

Message: Method not found: 'System.String Microsoft.VisualStudio.TestTools.UnitTesting.TestResult.get_TestContextMessages()'.


在“引用”下,在我的单元测试项目(在 Visual Studio 中)中,我有以下内容:

Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter

Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices

Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface

Microsoft.VisualStudio.TestPlatform.TestFramework

Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions

Moq

Ploeh.AutoFixture

Ploeh.AutoFixture.AutoMoq


有人知道这里有什么问题吗?

最佳答案

所以问题本质上是我在上一条评论中描述的问题,即如果您在 Visual Studio 2015 中创建一个新的单元测试项目,它带有 Microsoft.VisualStudio.QualityTools.UnitTestFramework 已安装。如果然后安装 MSTest.TestFramework 来自 NuGet,这将是 MSTest 版本 2(这一点很重要,请注意),这将为诸如 之类的测试属性创建模棱两可的引用问题。测试类测试初始化​​ ,即单元测试项目无法编译。

为了解决上述问题, Microsoft.VisualStudio.QualityTools.UnitTestFramework 可以从项目中删除引用。这使得一切正常,我的项目就是这种情况。但是过了一段时间后,不知什么原因,我的单元测试项目中的某些东西被破坏了,我开始在原始帖子中收到错误消息。为了解决这个问题,我创建了一个新的单元测试项目,将我所有的单元测试移到其中,添加了一个引用 MSTest.TestFramework 并将其删除到 Microsoft.VisualStudio.QualityTools.UnitTestFramework .

Here是一个相关的问题。

关于unit-testing - MS 测试 "Method not found: System.String"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45090890/

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