I would like to be about to use a list, array, and/or seq as a parameter to xUnit\'s InlineData.
In C# I can do this:
using Xunit; //2.1.0
namespace C
Building further on @Assassin's brilliant answer -- now we have implicit yields you can put the test cases in an array and dispense with the yields. I would also be tempted to add a cheeky little private operator to handle the object conversions. Thus:
open System
open Xunit
let inline private (~~) x = x :> Object
let degreesToRadiansCases =
[|
// Degrees; Radians
[| ~~0.0; ~~0.0 |]
[| ~~360.0; ~~(Math.PI * 2.0) |]
|]
[]
[]
let ``Convert from degrees to radians`` (degrees, radians) =
let expected = radians
let actual = Geodesy.Angle.toRadians degrees
Assert.Equal(expected, actual)
let stringCases =
[|
[| ~~99; ~~"hello1" |]
[| ~~99; ~~"hello2" |]
|]
[]
[]
let ``tests`` (i, s) =
printfn "%i %s" i s
Assert.Equal(s, "hello1")