C
C#11mo ago
Salah Tanbour

✅ Vertical Slicing with MediatR and Unit Testing

Hello everyone. I've recently come across Vertical Slice architecture and was amused by it, I think it is a nice approach to build a web api based on features. I've watched Jimmy Bogard's talk on Vertical slicing with MediatR, but was confused on how to implement unit testing. I only have a controller which send commands or queries through a mediator object, and a handler that handles this request. In his talk, Jimmy said to not worry about unnecessary abstractions like a Repository for example, we can just pass in the DbContext (in the case of EF Core). But if that's the case, how can I actually unit test my code when all of my code is inside the handlers since they aren't too big.
No description
5 Replies
Salah Tanbour
Salah TanbourOP11mo ago
Should I create a repo that wraps Dbcontext to mock it?
jcotton42
jcotton4211mo ago
$close since you're being helped in #architecture
MODiX
MODiX11mo ago
Use the /close command to mark a forum thread as answered
jcotton42
jcotton4211mo ago
(please)
Salah Tanbour
Salah TanbourOP11mo ago
ok
Want results from more Discord servers?
Add your server