5
我想使用審批測試,但甚至不能運行「Hello World」。當我運行測試,我得到審批 - 測試拋出System.MissingMethodException
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()'.
我的班級:
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");
}
}
}
我應該怎麼做,使這個運行,並創建一個文件?
不知何故我有版本3.0.1。已更新至3.0.11,現在可以使用。謝謝! –
這是因爲NuGet的默認依賴關係行爲,即安裝依賴包的最低版本。因爲它看起來很喜歡ApprovalTests 3.0.11至少需要ApprovalUtilities 3.0.11才能工作,所以它可能應該添加到它的清單中。 – ngm
爲了方便起見,下面是Package Manager Console命令來複制粘貼並運行: Update-Package ApprovalUtilities -version 3.0.11 – Victoria