Lurker News
Instead 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 comments
rfrey#
Learning how to blacksmith. Found a nice 200# anvil at an auction, built a forge and ribbon burner for it, and am about to fire it up tomorrow.
roland35#
I started doing pen plots with my 3d printer, and quickly realized while fun, it isn't that great at the job! So I am now printing and building a dedicated pen plotter I found on Thinkiverse (Drawbot), which is the first mechatronic machine I am doing!

https://www.thingiverse.com/thing:2349232

gwbas1c1 reply#
I'm trying to write a test tool that recompiles a .Net binary so you can swap in mock objects without dependency injection. The goal is to allow you to write normal code without all the ceremonies needed to make it testable; and the let the test tool create testing hooks after compilation.

It's interesting working closer with IL, and without a lot of StackOverflow posts when I get stuck.

hoofhearted1 reply#
Similar to Moq?
gwbas1c#
In order to use Moq (or NMock, or similar,) you need to use techniques like dependency injection.

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.

Load more comments