Closed halzate93 closed 3 years ago
Yes, you need to have Moq.dll installed. It's in the 'Optional Extras', you will need to unzip the Moq library. And drop it somewhere in your Assets folder. Then you need to reference the dll from your test folder's asmdef file. Like this: (Note: I don't have Moq here but NSubstitute)
You can read more about installation here
Referencing assemblies differ in every Unity version since 2019.1. So yo probably need to change the internal Zenject tests as well (if you want to run these from this repo)
Hi @Mathijs-Bakker thanks for your response,
The Moq.dll I used is inside the Automocking folder, that's where the zip ships in. I moved it to the location as you describe but I'm still getting the exact same error. Just to clarify have you seen the error I'm getting before? the one about Moq internal constructor not working with Reflection? It seems like the tests are finding Moq just fine, the problem happens at the reflection step.
I figured it out with the steps you suggested, thank you!
Hi,
I'm trying to setup Moq with Unity following the process described at: https://github.com/modesttree/Zenject/blob/master/Documentation/AutoMocking.md
However when I try to call any function inside Moq with the installers I'm getting the same error:
I tried setting up an independent project with only Zenject and it fails the Unit tests inside the Automocking zip.
I'm using Unity 2019.4.6f1 and the Zenject 8.0 release unity package from this github. My Scripting backend doesn't work on neither Mono nor IL2CPP and my API compatibility level is .NET Standard 2.0 so I'm using the 3.5 dll.
Here is my repro project: https://drive.google.com/file/d/1U3Cs6jyFrbhbvJoNPuO8YO6g0aTvUYuF/view?usp=sharing
Is there something obvious I'm missing?