如何使用Xunit运行FsCheck

Adr*_*ian 2 f# xunit xunit.net fscheck f#-fake

嗨,我正在尝试运行FsCheck.Xunit测试xunit.runner.console并获得以下异常:

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)
Run Code Online (Sandbox Code Playgroud)

我想跟随Mark Seemann的谈话.我的设置如下:

我有一个单独的库类型项目,有两个文件.一个是要测试的代码,另一个是测试代码.该项目编译得很好.我没有使用VS IDE,只是使用VSCode文本编辑器和F#的Ionide插件.

我已经尝试过使用和不使用FSharp.Corenuget安装的各种设置,有和没有版本规范FSharp.Core.

知道在哪里看得更远吗?我的想法已经用完了,感到很沮丧.我已经花了两天时间.:)

Adr*_*ian 5

通过添加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>
Run Code Online (Sandbox Code Playgroud)

我之前做过这个,但使用VSCode + Ionide没有将配置文件添加到项目中.所以,非常重要的是,不要忘记将app.config文件添加到项目中.仅在项目文件夹中创建文件是不够的.