sharp bites

standing on the shoulders of giants

AltNerdDinner: Part 1. Removing unwanted dependencies

The first thing I have done is to set up the project on github, so if you want to have a look at the code, check the AltNerdDinner repository. Then I set up the project following the guidelines of my series Continuous Integration series.

Now we are set, there is some stuff I don’t want in AltNerdDinner, so I am mercilessly going to get rid of it.

Bye, MSTest

MSTest gives nothing useful beyond integration in VS (for which I prefer ReSharper’s Test Runner or TDD.NET). I won’t say it sucks, but Phil Haack did. It’s just there to satisfy MS-Only shops. It’s slow, and it evolves slowly too. It lags behind the alternative frameworks. Oh, and it requires VS to be installed on your build server (crazy!), and…

So I replaced it with good ol’  NUnit. It basically involves replacing:

using Microsoft.VisualStudio.TestTools.UnitTesting; by using NUnit.Framework;

[TestClass] and [TestMethod] by [TestFixture],  and [Test]

and a bunch of calls to Assert.IsInstanceOfType(object, type); by Assert.IsInstanceOf(type, object); (pay attention to the signature change!).

We don’t need no membership provider

Right now I don’t want to deal with membership provider. I think it’s bloated and I don’t want to have to mess with the authentication right now, so I am going to replace it with a FakeMembershipService for the moment and leave the decision of whether revisiting it or completely replacing it (probably the latter) for a later time.

LINQ to SQL is dead, long live NHibernate

L2S is probably a decent option for this kind of simple app, and it’s very easy to quickly duct-tape a simple app. It has some goodies, like the visual designer and of course Linq. But it’s not the best option if your app gets bigger and you need some more advanced ORM features, like different mapping capabilities or different databases support. It’s not a bad tool, but it has some limitations that need to be addressed and, unfortunately, the fact that L2S is being killed means you are better not investing hard into it.

So I am planning to replace it with NHibernate, a mature and tested product  that fits my needs. But just not yet. Right now, I will simply remove the L2S stuff and work with POCOs and an InMemoryRepository implementation (which is basically the FakeDinnerRepository present in the Tests project).

The model

As we can see on the picture of the original model, the domain is quite simple.image

I have simply created POCO classes replacing the L2S generated ones.

After all the changes, we run all the tests and…

tests-green

We’re done!

Comments