Saturday morning, trying to set up an automated testing environment on my own since at the workplace it's not considered something useful and time should be spent on other stuff. Yay.
Been there another couple of times, both times failed due to poor, overcomplicated architecture that makes use of DI in the very places it shouldn't (and vice versa)... but then I finally found where the DB access is configured and thought "well, let's try tomorrow to automate this bitch".
...turns out, the db access object is injected indeed, but... from a static, deeply nested configuration file, that's referenced EVERYWHERE and embedded in the project core dll.
So basically I can't use a mock DB without changing it in the original config and recompiling the actual project I'm testing, not the test project itself. WTF?!
Or maybe I'm missing something... god, I hope it's me missing something here.
I hope so much to be wrong...

  • 1
    Static injection prevents mock testing

    Refactor and be done with it
Add Comment