我试图让你的代码在一个简单的F脚本文件中进行类型检查,我唯一要做的就是改变你的大写字母。
True
小写字母
true
.
我输入的完整脚本检查良好,包括所有必要的定义和引用,如下所示:
#r @"packages\Moq\lib\net45\Moq.dll"
#r @"packages\NUnit\lib\net45\nunit.framework.dll"
#r @"packages\FsUnit\lib\net46\FsUnit.NUnit.dll"
#r @"packages\System.Threading.Tasks.Extensions\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll"
open Moq
open FsUnit
open System.Threading.Tasks
type MemberMarketUpdate =
{ Id: string }
type IAssociationRepository =
abstract Update : MemberMarketUpdate -> Task<bool>
let verifyUpdate(update:MemberMarketUpdate) =
update.Id |> should equal "market id"
let associationRepository = new Mock<IAssociationRepository>();
let setup = associationRepository.Setup (fun r -> r.Update(It.IsAny<MemberMarketUpdate>() ))
setup.Callback(fun update -> verifyUpdate update) |> ignore
setup.Returns(Task.FromResult(true))
setup.ReturnsAsync(true)