我做了以下课程:
type numbers(Roman:string, CommonNumber:string)=
member this.RomanNumber=Roman
member this.ExpectedNumber=CommonNumber
member this.MakeComparision()=
string (convert(Roman))= CommonNumber
然后我尝试对它运行以下测试:
#if INTERACTIVE
#r @"..\packages\NUnit.2.6.4\lib\nunit.framework.dll"
#r @"..\packages\FsUnit.1.4.0.0\lib\net45\FsUnit.NUnit.dll"
#endif
open NUnit.Framework
open FsUnit
[<TestFixture>]
type ``Given a Roman number ``()=
let setNumbers=new numbers("XCIX","99")
[<Test>]
member this.
``Whether the right convert for this number must be exist``()=
setNumbers.MakeComparision() |> should be true
在最后一行setNumbers.MakeComparision() |> should be true
,关于字true
,我有以下错误:
The type bool in not compatible with type Constraints.constraint
我无法处理!!
答案 0 :(得分:1)
您需要将equal
与true
值一起使用:
member this.
``Whether the right convert for this number must be exist``()=
setNumbers.MakeComparision()
|> should equal true
或者您需要将True
约束与be
一起使用:
member this.
``Whether the right convert for this number must be exist``()=
setNumbers.MakeComparision()
|> should be True