ssannandeji / Zenject-2019

Dependency Injection Framework for Unity3D
MIT License
2.53k stars 363 forks source link

How to validate object graph as an automated test outside of Unity #659

Open mkrzaczek opened 5 years ago

mkrzaczek commented 5 years ago

I am creating an external library (that will be later used in Unity) using Zenject. I would like to check if I can successfully resolve bind objects using an automated test. Eg. I have the following:

container.Bind<TBind>().To<TTo>().AsSingle();

To test this simple graph I can just call

container.Resolve<TBind>()

and see if there is any exception thrown.

However this is getting much more complicated once using constructs like WhenInjectedInto. Is there any out-of-the-box solution for this? Or has someone wrote their own working solution and would like to share?

I realize, that there is a Validator when using Zenject withing Unity. But I want to validate the graph without Unity.