Random NUnit Tip

Often when writing NUnit tests I find myself wanting to output some stuff to the Console in order to make sense of a failing test. But, you don’t want the console window filling up with rubbish when the test is passing, so instead of doing this…

[Test]
public void DoesSomething()
{
string expected = “some expected result”;
object someObject = new SomeObject();
string actual = someObject.DoesSomething();
Console.WriteLine(expected);
Console.WriteLine(“—-“);
Console.WriteLine(actual);
AssertEquals(“SomeObject should do something”, expected, actual);
}

you can do this…

[Test]
public void DoesSomething()
{
string expected = “some expected result”;
object someObject = new SomeObject();
string actual = someObject.DoesSomething();
try
{
AssertEquals(“SomeObject should do something”, expected, actual);
}
catch(AssertionException)
{
Console.WriteLine(expected);
Console.WriteLine(“—-“);
Console.WriteLine(actual);
throw;
}
}

Then the Console output only shows up when the test fails. Nice.

Jet Brains ReSharper

Another C# refactoring tool crossed my browser windows today…

JetBrains ReSharper The Jetbrains C# plugin for Visual Studio EAP program is open: http://www.jetbrains.net/resharper The username and password are both ‘eapuser’.

I haven’t tried it yet.

Building a simple CMS XML Placeholder

I’ve just been down to see some guys in the middle of nowhere… Beautiful little office on a deer park, with views over fields and so incredibly quiet. A company called Torchbox who are getting up-to-speed with MS CMS.

While I was there the big question was why one of their placeholders wasn’t working, which I think we figured, but I also put together a very basic XML Placeholder control to act as a base for them. I thought it would be worth dropping it up here for the record.

Continue reading

XP Toolset for .Net

We’ve started doing TDD and Continuous Integration a bit more formally and have brought together a toolset to support this on the .Net platform. For reference this is currently:

Visual Studio.Net – IDE
Visual SourceSafe – Configuration Management
nUnit – Unit Test Framework
CruiseControl.Net – Continuous Integration Process
nAnt – .Net Build Tool
FXCop – Coding Standards validator
DevPartner Profiler – Performance Analysis and Test Coverage

Dynamic Image Generation

The .Net Framework has, like many frameworks and class libraries before it, some natty little features for drawing images and for saving or streaming them in different formats.

As part of getting to grips with C# I decided to put together some image generation routines for web based buttons, but discovered that it was not all as simple as it should be.

Continue reading

.Net Reflector

Morgan Skinner put me onto a very nice little toy today called .Net Reflector.

Basically, it uses reflection to scan through assemblies and list the namespaces, classes, methods and properties therein. Incredibly useful for scanning through the framework classes and finding the bits you need.

http://aisto.com/roeder/