5

I am trying to use Approval-Tests but can't even run "Hello World". When I run the test I get

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()'.

My class is:

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");
        }
    }
}

What should I do to make this run and create a file?

Lassi Autio
  • 1,147
  • 1
  • 13
  • 35

1 Answers1

6

Something is odd on the Nuget install. If you update ApprovalUtilities it will work.

llewellyn falco
  • 2,281
  • 16
  • 13
  • 1
    Somehow I had version 3.0.1. Updated to 3.0.11 and now it works. Thanks! – Lassi Autio Apr 29 '16 at 13:18
  • 2
    This is because of NuGet's default dependency behaviour, which is to install the lowest version of a depended-upon package. As it looks likes ApprovalTests 3.0.11 needs at least ApprovalUtilities 3.0.11 in order to work, it should probably be added to its manifest. – ngm Jul 26 '16 at 10:16
  • For general convenience, here's the Package Manager Console command to copy-paste and run: Update-Package ApprovalUtilities -version 3.0.11 – Victoria Aug 16 '16 at 16:04