Sometimes, unit tests are really small – so small that they fit on a single line:
module inside module
Nested modules allow putting unit tests into a hierarchy.
double backtick identifiers
Get nice to read test identifiers by using double backticks.
Unquote
The test <@ ... @>
function is from Unquote – my favourite assertion library. Just write code, no special assertion (fluent) syntax.
%% Operator
We use the %%
operator to generate test values from strings. Here, it generates an employee ID. We do this because we use a lot of handwritten IDs in our tests, and this reduces visual noise dramatically in bigger tests.
Ask if you want to know how this works 🙂
Additional notes
FsToolkit.ErrorHandling
is not used in this code. But since we use it a lot, I added it to the F# file template.