mrpmorris / Fluxor

Fluxor is a zero boilerplate Flux/Redux library for Microsoft .NET and Blazor.
MIT License
1.22k stars 139 forks source link

IStateSelection resolving for unit tests #437

Open PikoooX opened 1 year ago

PikoooX commented 1 year ago

I got a situation that I am unsure how to handle. I have a component that has two state selectors which are generic and of the same type IStateSelection<State, int> and are in the same parent state. I am using BUnit tests with Moq, is there a way to register a service or a state in the test context that would result in these two selectors receiving different values? I can't really use ques for mocking setup cause that would be quite hard since the states are being called in multiple places so there is no way to determine the order of calls.

mrpmorris commented 1 year ago

I'm sorry, I don't know the answer to this question. Have you asked in Moq?

PikoooX commented 1 year ago

I have found a hacky way arround it, I guess there is no real way of resolving it. You can always box those two values in a record or a class and then do it that way. I will see if it can be done through Moq.

mrpmorris commented 1 year ago

Please keep me updated, I am very interested.