[英]How to run FsCheck with Xunit
Hi I am trying to run FsCheck.Xunit
tests with xunit.runner.console
and getting the following exception: 嗨,我正在尝试使用xunit.runner.console
运行FsCheck.Xunit
测试,并得到以下异常:
Kata.TennisProperties.Given advantaged player when advantaged player wins score is correct [FAIL]
System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
---- System.Exception : The type Kata.Tennis+Player is not handled automatically by FsCheck. Consider using another type or writing and registering a generator for it.
Stack Trace:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
I am trying to follow Mark Seemann's talk . 我想听马克·西曼的讲话 。 My setup is as follows: 我的设置如下:
I have a single library type project whith two files. 我有一个带两个文件的库类型项目。 One with the code to be tested and one with the test code. 一种带有要测试的代码,另一种带有测试代码。 The project compile just fine. 该项目编译就好了。 I am not using the VS IDE but just VSCode text editor with Ionide plugin for F#. 我不是使用VS IDE,而是使用带有Ionide F#插件的VSCode文本编辑器。
I have tried with various setups with and without FSharp.Core
nuget installs, with and without version specification of FSharp.Core
. 我曾尝试与有和没有各种设置FSharp.Core
的NuGet安装,使用和不使用的版本规范FSharp.Core
。
Any idea where to look further? 任何想法在哪里进一步看? I am running out of ideas and getting frustrated. 我的想法耗尽了,感到沮丧。 I've already spent two days on this. 我已经花了两天了。 :) :)
Fixed this by adding the app.config
file bellow. 通过添加以下app.config
文件来修复此问题。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.4.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
I did this before but using VSCode + Ionide didn't got the config file added to the project. 我之前做过,但是使用VSCode + Ionide并没有将配置文件添加到项目中。 So, very important, don't forget to add the app.config
file to the project also. 因此,非常重要,不要忘记将app.config
文件也添加到项目中。 It is not enough to just create the file in project folder. 仅在项目文件夹中创建文件是不够的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.