1

I'm trying to find a way for mocking objects without creating interfaces ( my boss told me so) but so far the only way I found is to actually create a new monobehaviour with fake methods in it and run the tests through that. Do you know a better way as this one takes a lot of time?

  • I don't have an answer but I found some interesting links with workarounds and suggestions. I'm not sure if it applies to Unity but it may give you some ideas. See [Is it recommended to mock concrete class?](https://stackoverflow.com/q/12174304/5170571) and [How do I mock a class without an interface?](https://stackoverflow.com/q/20400734/5170571) – sonnyb Apr 15 '19 at 14:35
  • Thanks, but it doesn't help for unity related stuff. Most of the classes in Unity derive from MonoBehavior and that is tied to unity's runtime. From what I've seen everyone uses interfaces to go beyond that limitation, but I am not allowed to, for now I hope. – Horia Rotaru Apr 15 '19 at 15:07

0 Answers0