我想在 F# 中使用 xUnit 对这段代码进行单元测试。我如何处理这些选项?
来自 Scott Wlaschin 的书:Domain Modeling Made Functional
type UnitQuantity = private UnitQuantity of int
// ^ private constructor
// define a module with the same name as the type
module UnitQuantity =
/// Define a "smart constructor" for UnitQuantity
/// int -> Result<UnitQuantity,string>
let create qty =
if qty < 1 then
// failure
Error "UnitQuantity can not be negative"
else if qty > 1000 then
// failure
Error "UnitQuantity can not be more than …Run Code Online (Sandbox Code Playgroud)