EvoEsports / EvoSC-sharp

Next generation server controller for Trackmania written in C# using .NET 8.
https://evosc.io
GNU General Public License v3.0
20 stars 15 forks source link

Mockable controller context #164

Closed snixtho closed 1 year ago

snixtho commented 1 year ago

Is your feature request related to a problem? Please describe. When trying to test controllers that uses the context object, it will fail as there is no way to mock the context model. Especially when working with the audit system, this problem arises.

Describe the solution you'd like We need a way to fully mock the state of controllers so that we can create meaningful tests for controllers and module services. The straight forward solution is to create interfaces for each of the context objects, as well as the audit builder in the core. We should at the same time look for other models and builders that might need to be mockable.

Describe alternatives you've considered The current workaround is to mock IContextService to return a custom object of the context and audit builder. But this is unnecessarily complex.