3
我认为这与使用times
论点Verify()
有关。为什么从F#调用Moq会引发异常?
open NUnit.Framework
open Moq
type IService = abstract member DoStuff : unit -> unit
[<Test>]
let ``Why does this throw an exception?``() =
let mockService = Mock<IService>()
mockService.Verify(fun s -> s.DoStuff(), Times.Never())
异常消息:
System.ArgumentException:不能用于类型的构造器参数类型的 'System.Void' 表达 'Microsoft.FSharp.Core.Unit'
我想你的意思是nuget包添加了VerifyFunc和VerifyAction扩展方法,而不是重载。 – Andy