Reputation: 115
I am taking my first steps with F# and testing with FsUnit.xUnit. In Visual Studio 2017 I set up a brand new F# project and add a test project. To the test project I NuGet FsUnit.xUnit 3.0.0 and then NuGet FsUnit.xUnit.Sample. Everything builds. Tests then fail with
System.IO.FileLoadException
Could not load file or assembly 'FSharp.Core, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at ApplicationLibraryTest.Tests.Given a LightBulb that has had its state set to true.when I ask whether it is On it answers true.()
After reading the FsUnit Homepage and FsUnit Issues I add an app.config
with
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="4.4.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
As FSharp.Core.dll in bin/debug
is version 4.4.1.0.
Running tests again gives
System.IO.FileLoadException
Could not load file or assembly 'xunit.assert, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at ApplicationLibraryTest.Tests.Given a LightBulb that has had its state set to true.when I ask whether it is On it answers true.() in D:\git\ApplicationLibrary\ApplicationLibraryTest\FsUnitSample.fs:line 18
So i add another redirect in app.config
as follows
<dependentAssembly>
<assemblyIdentity name="xunit.assert" publicKeyToken="8d05b1bb7a6fdb6c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="2.2.0.0" />
</dependentAssembly>
version 2.2.0.0 being the version of xunit.assert that i find in bin\debug
.
Yet again the tests fail. This time with
System.IO.FileLoadException
Could not load file or assembly 'xunit.assert, Version=2.2.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at ApplicationLibraryTest.Tests.Given a LightBulb that has had its state set to true.when I ask whether it is On it answers true.() in D:\git\ApplicationLibrary\ApplicationLibraryTest\FsUnitSample.fs:line 18
System.IO.FileLoadException
Could not load file or assembly 'xunit.assert, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
(Exception from HRESULT: 0x80131040)
Exception doesn't have a stacktrace
Test Project Details: Target F# runtime: 4.4.1.0
Target Framework: 4.6.2
What am i doing wrong? Is this a configuration issue or is there something that i'm missing that's stopping FsUnit.xUnit from running tests?
Upvotes: 3
Views: 250