Peter Provost's Geek Noise

Rants, rambles, news and notes from another geek

Updated NUnit Plugin for VS11 Released

Good news!! Last night I got an email from Charlie Poole, the maintainer of NUnit pointing me to a blog post he’d just made:

Today, I’m releasing version 0.92 of the NUnit Adapter for Visual Studio and
creating a new project under the NUnit umbrella to hold it’s source code, track
bugs, etc.

In case you didn’t know, Visual Studio 11 has a unit test window, which
supports running tests using any test framework for which an adapter has been
installed. The NUnit adapter has been available on Code Gallery since the
initial VS Developer preview. This release fixes some problems with running
tests that target .NET 2.0/3.5 and with debugging through tests in the unit
test window.

Games I’m Enjoying Lately

I first started playing games on computers the day after we got our first computer way back in 1978 or 1979 on our venerable Ohio Scientific Challenger 4P. Man, those were good times. Tanks and mazes… that was about all we had.

In the 80s, when we lived in Egypt and had an Apple II+, I would type the games in, line-by-line, from the backs of magazines. I’m still convinced that I really learned to debug computer programs back in these days.

And I’ve been a gamer ever since.

Lately, I’ve been playing a bunch of different games, looking for something that I can really get into for a while. Although I’ve had fun playing almost all of them, I’ve still not found any with real staying power for me. But I have had a chance to play a number of different games on a few different platforms.

Here are some review of what I’ve been playing lately, and a look to what I’m waiting for.

Kata - the Only Way to Learn TDD

Lately I’ve been asked by more and more people inside Microsoft to help them really learn to do TDD. Sure, they’ve read the books, and probably some blog posts and articles, but they are struggling to figure it out.

But with so many people talking about how good it is they are frustrated that when they try to apply it at work, in their day job, it just doesn’t seem to work out.

My guidance to them is simple. Do a TDD kata every morning for two weeks. Limit yourself to 30 minutes each morning. Then pick another kata and do it again.

Visual Studio Fakes Part 2 - Shims

Let me start by saying Shims are evil. But they are evil by design. They let you do things you otherwise couldn’t do, which is very powerful. They let you do things you might not want to do, and might know you shouldn’t do, but because of the real world of software, you have to do.

The Catch-22 of Refactoring to Enable Unit Testing

In the first part of my series on VS11 Fakes, I reviewed Stubs, which are a simple way of creating concrete implementations of interfaces and abstract classes for use in unit tests.

But sometimes it happens that you have to test a method where the dependencies can’t be simply injected via an interface. It might be that your code depends on an external system like SharePoint, or simply that the code news up or uses a concrete object inside the method, where you can’t easily replace it.

The unit testing agilista have always said, “Refactor your code to make it more testable,” but therein lies the rub. I will again refer to the esteemed Martin Fowler for a quote:

How to Avoid Creating Real Tasks When Unit Testing Async

UPDATE: Stephen Toub pointed out that in .NET 4.5 you don’t need my CreatePseudoTask() helper method. See the bottom of this post for more information.

If you’ve been coding in VS11 Beta with .NET 4.5 you may have started experimenting with using async and await in your programs. You also probably noticed a lot more of the APIs you consume are starting to expose asynchonous methods using Task and Task<T>.

This technology let’s use specify that operations are long running and should be expected to not return quickly. You basically get to fire off async processes without you having to manage the threads yourself. Behind the scenes, the necessary state machine code is created and, as they say, “it just works”.

I would really recommend reading all the great posts by Stephen Toub and others over on the PFX Team blog. And of course the MSDN Docs on the Task Parallel Library should be reviewed too.

But did you know that in VS11 Beta you can now create async unit tests? Both MS-Test and the newest version of xUnit.net now support the idea of a unit test that is async, and can therefore use the await keyword to block on a call that returns a Task.

Editing Octopress/Jekyll Posts in Vim

Update - I was able to get backtick code blocks working much better, and made a stab at the YAML Front Matter, but it doesn’t seem to work using syntax include. See the git repo for the updated source.

I use Vim as my day-to-day, non-IDE text editor. Yeah, I know everyone is in love with Notepad2, Notepad+ or whatever the new favorite on the block is. I’ve been a vi/vim guy for ages and am not gonna change.

Since switching my blog to Octopress, I’ve been writing all my posts in Vim. Vim does a nice job with Markdown, but it doesn’t know anything about the other things that are often used in a Jekyll markdown file.

The two big things are:

  1. It gets confused by the YAML Front Matter
  2. It can go nuts over some of the Liquid filters and tags

Fortunately Vim has a nice way of letting you add new things to an existing syntax definition. You just create another syntax file and put it in the after directory in your ~/.vim directory. Then you just add the new syntax descriptors and restart Vim.

Rules of the Road (Redux)

It is so much fun to go back and look at old posts. I saw Scott Hanselman mention on Twitter that he’d recently marked his 10th anniversary as a blogger. Since I just converted all my posts from SubText to Markdown, I’ve been going through the older ones. Sometimes I find one and say “Ugh, did I really say that?” but other times I find a good one and it still resonates with me as much as it did when I originally wrote it.

This is about one of those good ones.

The post I found was from January 29, 2009 and was called Rules of the Road. In that post I talked about how I found these stashed away in a OneNote file from 2006, so these have been with me for a while.

Mastering My Machine Repaves With Git and PowerShell

You repave how often?

I’ve always been someone who likes regularly rebuilding my Windows machines. (See this post or this post for some ancient history on this.) I know this isn’t needed as much as it used to be, but I still find myself starting to get that itch anywhere from 6-weeks to 3-months after I last flattened the box.

I’m convinced that part of this is due to my willingness to try out new apps, hack on things, mess with my registry, try beta drivers, etc. Say what you will… Those things make me happy!

So rather than curtail those things, I just figure out ways to get around it. As I like to explain to my wife, “What I really enjoy is bending computer to my will.”

Solarized Colors for Visual Studio 11

Update: I sent a pull-request to David Thibault and this update is now in his mainline repository.

I’m sure everyone and their dog knows by now that we changed the color theme in VS11 Beta to something a little more… ummm… monochromatic.

If you didn’t read about it, you should visit the Visual Studio blog and read Introducing the New Developer Experience.

Regardless of what you think about it, I do know that the UX designers had an admirable goal in mind, and that was making the code be the bit you see the most, and take the chrome out of your line of sight. The idea is to let you focus where it matters and not have Las Vegas lights happening all around it distracting you.

Regardless, I’m not here to comment on all that, but on what I like to do to make the experience even better.

SOLARIZE IT!

Return of Game of Thrones

How psyched was I when a few weeks ago my wife Emily decided to start watching Game of Thrones (which I had kept on our media server hoping this would happen). You see, I’ve read all of the books and thoroughly enjoyed the HBO adaptation of Book 1. But she’s not historically been a huge fan of sci-fi or fantasy stuff.

But when she came to me and said, “Honey I can’t stop watching it,” I knew she was hooked and I’d have someone to watch Season 2 with. She also has had a thing for Peter Dinklage since The Station Agent, so that helps a bit. Ned getting killed at the end of Season one sent her for a bit of a loop, but she’s just gonna have to get used to George R. R. Martin killing off characters.

So now each week we sit together and enjoy the carnage that is this world. The season is going well so far. It seems to be following the book reasonably well, and of course they’re working in all the new characters we’ll need for this book’s storyline. I don’t want to give anything away, but it should be quite interesting to see how they handle some of the things to come.