3 ms·
Usually your database connection is a function that is passed as a parameter to the functions using it. That way you don't need to Mock, but you can input a "c
by carlmr 3y ago
Usually your database connection is a function that is passed as a parameter to the functions using it.
That way you don't need to Mock, but you can input a "connection" during testing that does what you expect.
If you say "well now I have to type extra parameters everywhere", this is usually solved with partial application. I.e. you create findings from your functions that have the Db Connection already baked inside.
https://fsharpforfunandprofit.com/posts/low-risk-ways-to-use-fsharp-at-work-4/ https://fsharpforfunandprofit.com/posts/low-risk-ways-to-use...
https://fsharpforfunandprofit.com/posts/partial-application/ https://fsharpforfunandprofit.com/posts/partial-application/