Geeks With Blogs

The Life and Times of a Dev Yes, we're really that weird November 2014 Entries
Unit Testing Multi-threaded code
I spent the day today writing unit tests for code I wrote yesterday. No, I’m not a big fan of TDD. I am, however, a big fan of high (as close to 100% as practical) code coverage. The device I’m working on is very multi-threaded. As a matter of fact, a key principle is DON’T BLOCK! Because of this, there are quite a few Task’s, lots of awaiting, and several timers that poll on a regular basis. This makes for code that can be tricky to unit test. After all, if you’re not blocking, you’re on a different ......

Posted On Thursday, November 27, 2014 12:29 AM

Testing EntityFramework with Moq
Let’s face it, EntityFramework is a pain to mock. With few interfaces, testing things that use it can be a real pain. Here’s a few things I’ve found to make it easier: Make sure that you have an interface for your DbContext object so that it can easily be mocked. If you’re doing Database First, be aware that EF 7 will eliminate EDMX support, so welcome to the code first era (I hear you . . .). Rather than using your Dependency Injector to directly inject an instance of your IDbContext, create a context ......

Posted On Thursday, November 20, 2014 4:06 PM

Working with Hardware
I’m working on a hardware project that involves software controlling motors, grippers and the like. I can’t go into details on the project, but it’s quite a bit of fun. I’ve learned a really important design principle for hardware interaction. I’m sure some of you that have more hardware experience than I do will simply say, “duh”, but I had to learn the hard way. In version one, I made good objects for all of the components and then tied them together into a single device. They had base classes ......

Posted On Thursday, November 20, 2014 12:44 PM

Copyright © Robert May | Powered by: GeeksWithBlogs.net | Join free