✅ Mock a .NET library to test a minimal web API.
I'm busy developing a .NET minimal API to provide services (data access) for a MAUI app. The API must use a DAL that is, for now, hosted on Azure where it directly accesses a SQL Server database through EF. My first checkpoint is to test the web api locally to ensure endpoints are correctly set up etc. and to do so I'll need to mock the DAL (a single .NET DLL).
The DAL has no interfaces to mock, but I can add those if needed, but I was wondering id there was any way besides adding interfaces to automatically mock the DAL classes.
6 Replies
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
Thanks. I think I'l implement interfaces for services anyway, the DAL that I can't change has no services, just classes and methods
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
I don't own the code yet is half my problems
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
Thanks, I get that much, but I've decided to add a new 'layer' to add interfaces and services. I guess that wraps up this question then, thanks for your time.