Wednesday, October 13, 2004

Upcoming Changes to System.Xml in .NET Framework 2.0 Beta 2

Dare Obasanjo provides an overview on the upcoming changes to System.Xml in .NET Framework 2.0 Beta 2.

[Listening to: Collective Soul - All]

The Osherove.Interception framework

Roy Osherove presents his Osherove.Interception framework. I'm not entirely convinced of how I would use this (or even if I should) but it definetely deserves looking into despite his use of the word automagically. Ugh.

I had previously blogged about it here as it pertained to unit testing.

[Listening to: KoRn - Blind]

Saturday, October 09, 2004

Another keeper from MbUnit: AssemblySetUp/TearDown

Now that I've installed the latest MbUnit from TestDriven.NET I can make use of the TestFixtureSetUp and TestFixtureTearDown support in MbUnit (+ Assembly Setup and TearDown).

This has greatly simplified my code. In each of my test fixtures I used to have to have a SetUp method which calls a static initializer from another class to initialize my log4net stuff:

public class MyTests

{
[SetUp]
public static void SetUp()
{
StaticInitializer.Initialize()
}
[Test]
public voidSomeTest()
{
...
}
}

public static class StaticInitializer
{
private static bool s_bIsInitialized = false;
public static void Initialize()
{
if (!s_bIsInitialized)
{
log4net.Config.BasicConfigurator.Configure (...);
s_bIsInitialized = true;
}
}
}
Now all I need is:
public class MyTests

{
//No extra stuff at all
[Test]
public voidSomeTest()
{
...
}
}

[assembly: AssemblyCleanup (typeof (StaticInitializer))]
public static class StaticInitializer
{
[SetUp]
public static void Initialize()
{
log4net.Config.BasicConfigurator.Configure (...);
}
}
The rest is handled for me.

Sooo much nicer.

Friday, October 08, 2004

Loading an assembly from a "working directory" at design time

Steve Maine may have just helped me out of a problem that I didn't even know I had yet: Loading an assembly from a "working directory" at design time. Since I plan to load user assemblies I would've fallen over this eventually. Now I'm prepared... Or at least I've lost my excuse of not being prepared.

[Listening to: Collective Soul - The World I Know]

An exercise in implementing a domain-driven design

Steve Maine runs through a set of articles (Part I, Part II and Part III) doing an exercise in DDD (Domain Driven Design).

Not sure if I'll jump on the bandwagon, but it looked interesting enough to persist here.

[Listening to: Limp Bizkit - 9 Teen 90 Nine]

Wednesday, October 06, 2004

VS2005 Export Template Wizard

Craig Skibo details the new VS2005 Export Template Wizard. This seems to be a great way to provide out-of-the-box wizards to allow customers to customize your app.

[Listening to: George Clinton - The Shagadelic Austin Powers]

Unofficial NUnit Extensibility Framework (MbUnit too)

Roy Osherove puts together another creepy cool unit testing extension to both NUnit and MbUnit.

  • Introducing: Unofficial NUnit Extensibility Framework - make your own test attributes easily!

  • First the automatic database rollback feature, now this. Too cool.

    I echo Jonathan's sentiment: this belongs in TestDriven.NET

    [Listening to: Stone Temple Pilots - Sin]

    Wednesday, September 29, 2004

    System.Security.AccessControl

    Valery Pryamikov might have just saved me a bunch of spelunking through MSDN2 (which is still pretty raw.) I had reached a point where I wanted to start adding permission related unit tests, but I quickly got lost in beta documentation with no examples.

    I started going through Keith Browns excellent wikibook: "The .NET Developer's Guide to Windows Security" but quickly realized that I should just read the whole thing instead of just jumping in looking for a sample and jumping back out.

    So instead I added a nice juicy //TODO: so that I can see it in the task window (one of my favourite features of VS2003 and up) and moved on.

    What do I find today but a blog entry on Playing with System.Security.AccessControl.

    Nice.

    [Listening to: Primus - Fisticuffs]

    Thursday, September 23, 2004

    A couple links on MSMQ Processing

    Wallace McClure posts a couple of articles on MSMQ stuff:

  • MSMQ processing of a string
  • MSMQ Processing of multiple pieces of data

  • I haven't gone through them in any detail, but they look useful enough that I post it here so I don't lose them.

    [Listening to: KoRn - Blind]

    Saturday, September 18, 2004

    An alternate to MbUnit's CurrentFixture

    Now that my library of MbUnit unit tests is growing it's becoming a non-trivial amount of time to run them, something that I'd rather avoid when doing a very tight red/green/refactor loop.

    To speed things up I've been using the CurrentFixture attribute like so:

    [CurrentFixture]
    
    [Test]
    public void DoSomeTest()
    {
    ...
    and the associated property of the AutoRunner in main:
    public static void Main (string[] args)
    
    {
    using (AutoRunner auto = new AutoRunner ())
    {
    auto.Domain.Filter = FixtureFilters.Current;
    ...

    The issue is, I keep having to check out my previous test fixture to remove the attribute so I can worry only about my current fixture. That leads to a lot of comments like "Removed CurrentFixture attribute" in my version control.

    Here's what I now do. I don't use CurrentFixture at all. Instead I have the following in main:
    public static void Main (string[] args)
    
    {
    using (AutoRunner auto = new AutoRunner ())
    {
    auto.Domain.Filter
    = FixtureFilters.Type ("My.Full.Class");
    ...

    Now I only need to check out the main line (or more often just keep it checked out) to work on another fixture.

    [Listening to: Stone Temple Pilots - Trippin' on a Hole in a Paper Heart]