Ask HN: What you up to? (Who doesn't want to be hired?)
614 pointsInstead of talking jobs, what is everyone up to otherwise? Any interesting going on in life or with your hobby project?
Unfinished and novel ideas are of course most interesting, so feel free to share anything you're thinking about!
Comments (841) 296 threads
Earlier commentshttps://www.thingiverse.com/thing:2349232
It's interesting working closer with IL, and without a lot of StackOverflow posts when I get stuck.
With Moq, you just can't call "new Foo()" in your code, because that's not mockable. You need to pass in a delegate that returns an IFoo. Or, you can't use statics, because those aren't mockable. What I'm trying to do is take the compiled IL, automatically convert Foo to an interface, and replace "new Foo()" with calls to a delegate. Then in your test, you set the delegate and provide an IFoo. You could use Moq to make your IFoo.
Likewise, with Moq, if you're writing code against a 3rd party API based around static methods, you need to wrap them in an interface, make a shim object, write your code to the shim object... I'm trying to take IL that's directly calling static methods, and redirect them to an alternate class.
The point is that you don't need to write interfaces for every type you want to mock, nor do you need to use dependency injection in every class you want to unit test. All that is done automatically, after compilation.
All comments shown.
Couldn't load more comments. Check your connection and try again.