c# - 批准测试抛出 System.MissingMethodException

标签 c# .net unit-testing approval-tests

我正在尝试使用 Approval-Tests 但甚至无法运行“Hello World”。当我运行测试时,我得到了

Test Name:  TestHelloWorld
Test FullName:  HelloApprovalTests.Class1.TestHelloWorld
Test Source:    C:\Users\Lassi\Documents\Visual Studio 2015\Projects\HelloApprovalTests\HelloApprovalTests\Class1.cs : line 14
Test Outcome:   Failed
Test Duration:  0:00:00.01

Result StackTrace:  
at ApprovalTests.Namers.UnitTestFrameworkNamer..ctor()
   at ApprovalTests.Approvals.<.cctor>b__c()
   at ApprovalTests.Approvals.GetDefaultNamer()
   at ApprovalTests.Approvals.Verify(IApprovalWriter writer)
   at ApprovalTests.Approvals.Verify(String text)
   at HelloApprovalTests.Class1.TestHelloWorld() in C:\Users\Lassi\Documents\Visual Studio 2015\Projects\HelloApprovalTests\HelloApprovalTests\Class1.cs:line 15
Result Message: System.MissingMethodException : Method not found: 'System.Diagnostics.StackTrace ApprovalUtilities.CallStack.Caller.get_StackTrace()'.

我的类(class)是:

using ApprovalTests;
using ApprovalTests.Reporters;
using NUnit.Framework;

namespace HelloApprovalTests
{
    [TestFixture]
    [UseReporter(typeof(DiffReporter))]
    public class Class1
    {
        [Test]
        public void TestHelloWorld()
        {
            Approvals.Verify("Hello World Welcome to ApprovalTests");
        }
    }
}

我应该怎么做才能运行并创建文件?

最佳答案

Nuget 安装有些奇怪。如果您更新 ApprovalUtilities,它将起作用。

关于c# - 批准测试抛出 System.MissingMethodException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36908221/

相关文章:

c# - 没有消息帧的 TCP 上的 Xml

c# - EnvironmentPermission Deny 在 .Net 4.0 中已过时,有替代方案吗?

.net - _ViewStart.cshtml 中的 RenderSection() 问题

c# - .NET 异常有多慢?

ruby - spec 使用不同的配置运行同一组测试

visual-studio - 测试失败后在 Jenkins 中构建失败 MSTest

c# - 你如何设置 ApiController.User

c# - 三层架构模式

c# - 如何使用 C# 计算 DataTable 列的总和(总计)

c# - 命名空间 'Forms' 中不存在类型或命名空间名称 'System.Windows'