[Feature]: Make assertions with 'because' parameter more friendly to F#
See original GitHub issueBackground and motivation
I love FluentAssertions and use it for F#. However, F#'s overload resolution is different than that of C#. One effect is that all overloads with because
and becauseArgs
require specifying because
. For example,
result.Should().BeNull()
will not compile. Instead, it is required to write
result.Should().BeNull("")
This makes all assertions in F# more noisy. This is particularly noticeable for assertions that use a lambda parameter before because
, since then the lambda is not the last argument and it then requires extra parentheses.
I suggest adding overloads for all assertions that do not have because
or becauseArgs
. That will allow F# users to assert without having to specify empty strings everywhere.
While I cannot promise anything, I may be willing and able to do a one-time pass of the codebase and add these overloads (at least as long as you don’t see the need for separate tests and the overloads can just call existing overloads with an empty string argument). I can not prioritize adding and maintaining such overloads for all future assertions, but the additional work involved is trivial when new assertions are added.
Alternative Concerns
No response
Issue Analytics
- State:
- Created 3 months ago
- Comments:9 (5 by maintainers)
Top GitHub Comments
Thanks for the offer!
I find that FluentAssertions.FSharp makes it sound like an add-on to FluentAssertions, which it’s not. Indeed, in focusing towards F# users and their expectations and idioms, the library will actively take a step away from FluentAssertions in some respects (dropping/adding/changing functionality). Therefore, I’m leaning toward sticking with the current name, “Faqt”. In any case, my main motivation for OSS projects has never been getting the most users (though I of course want people who want/need it to know about it). Furthermore, if I get it posted on F# Weekly (which is just a tweet away), then I think that will be all the focused marketing I need.
FluentAssertions is however welcome to point F# users to Faqt! 🙂
Good idea to make a new library to improve the usage the usage for F# users 👍 It could even be an F# library with a name like
FluentAssertions.FSharp
orFluentAssertions.FSharpPolyfills
.