I had problems with decoupled scripts and exposing interfaces in Unity, and these answers helped me a lot. But now, since I don't have hard-coded references in my scripts, I wanted to write unit tests for my code.
This presented a problem - I can't instantiate MeonoBehaviours using
because of how the engine works. What is more, I can't mock out anything from the Unity API.
I found a great blog post by Tomek Paszek. He suggests using the Humble Object pattern, and it seems reasonable. Still, maybe thats just me, because I haven't used that pattern too much, when using the Humble Object pattern even simple code seems to be very complex.
Are there other ways to write testable MonoBehaviors?