Open johanhaleby opened 4 years ago
Thanks for opening the first F# issue we ever had. This gives me the opportunity to start having a F# test projects.
Thanks for opening the first F# issue we ever had.
@dupdob Oh wow :) I just started playing around with F# two days ago (as my first CLR language). I'm from a JVM background and I've been using assertj heavily for many years and I was glad to find this lib.
Hello! Although I love NFluent and would very highly recommend its usage on C# projects, I'm not certain this is the best fit for F# projects. The reason I'm saying this is because NFluent heavily relies on extension methods, type inference et implicit casts, in the way they work in C#. In F#, you code will work if you do the following:
let myList: int list = [1;2;3]
Check.That(events :> System.Collections.IEnumerable).Contains(1, 2, 3)
It's not the lack of support in NFluent here, it's that F# will not implicitely cast from FSharpList
@pirrmann Interesting point.
But for me at least, I think that it would be ok to add a small wrapper for F#
. For example in the case of FSharpList
I think it would be almost enough for NFluent provide a function that transforms the FSharpList
into an IEnumerable
or "sequence" (sorry for not being fluent in dotnet parlance yet).
I.e. the problem I have today is that this doesn't work:
let myList : int list = [1;2;3]
Check.That(events).Contains(1, 2, 3)
But if I simply change the code to this it works (or if I cast it to IEnumerable
that you imply) :
let myList : int seq = [1;2;3] |> Seq.ofList
Check.That(events).Contains(1, 2, 3)
If NFluent would provide a Contains
method that does this simple transformation it would be (almost) enough for me. The reason I say "almost" is that the HasSize
method is unavailable for sequences.
WDYT?
It would be great if NFluent would add support for asserting elements in an
FSharpList
the same way you can do on aSeq
orList
. I.e. allow this: