Results tagged “microsoft” from Appleseed Blog

And now a bit of Developer's Notebook-ery.

I have lately been learning the ropes of XNA Studio, Microsoft's free-beer framework for game development. It's especially helpful for those interested in creating software for the XBox 360 game console.

After spending some time doodling the basic class structures needed for the particular project I have in mind, it was time for me to write some tests. Since reading Damian Conway's excellent Perl Best Practices, I've been a devotee of test-driven development: a software-creation work cycle where the programmers write tests for their code even before they write they code being tested.

So you start with a bunch of tests that all fail, and you know your job is done when, however many work-hours later, they all pass. And then you keep those tests handy, so that they'll bark at you if any new code-change you introduce causes older code to break. This is all very good stuff, and I can't imagine working any other way, now.

But while I know all about writing tests in Perl on Unix, I knew next to nothing doing it with C# on Windows. A friend pointed me at NUnit, a Windows-programming port of a popular unit-testing framework from the Java world. Well, great, sez I; sounds perfect. But getting it to actually work for me was a chore. Here is what eventually worked for me.

  1. Installed Testdriven.Net, which includes two full versions of NUnit (among a bunch of other testing frameworks).
  2. In my copy of Visual C# 2005 Express Edition (a free-beer IDE that Microsoft recommends for XNA development), created a minimal test-using project based on this code snippet from the XNA forums.
  3. Manually added a reference to nunit.framework.dll to the project, as per that same post. Used NUnit's v2.2 framework, not v2.4.
  4. Launched the v2.2 NUnit's GUI testing application, and had it open the .dll file that the project's build process had created.

I found that trying this with the v2.4 NUnit stuff resulted in a dialog box full of verbiage that I'm currently too Windows-ignorant to grok, but there clearly seemed to be some kind of version mismatch afoot. I got the same message when I tried installing the latest version of NUnit directly. And I haven't been able to get Testdriven.Net itself working - it's supposed to integrate with Visual Studio itself. I am led to understand, though, that the fact I'm using Express versus a commercial edition may be an obstacle here.

I'm curious if things would have been easier if I were using Visual C# 2008 Express, instead of the 2005 version. But, it all works well enough for the nonce.

0