【发布时间】:2014-05-27 09:03:18
【问题描述】:
拥有
type Category(name : string, categoryType : CategoryType) =
do
if (name.Length = 0) then
invalidArg "name" "name is empty"
我正在尝试使用 FsUnit + xUnit 测试此异常:
[<Fact>]
let ``name should not be empty``() =
(fun () -> Category(String.Empty, CategoryType.Terminal)) |> should throw typeof<ArgumentException>
但是当它运行时我看到XUnit.MatchException。 我做错了什么?
【问题讨论】:
标签: f# xunit fsunit guard-clause