Category «C#»

Simulating SQL Server (Part 3)

If you haven’t done so so already, start with – Simulating SQL Server (Part 1) Simulating SQL Server (Part 2) In the first two posts, I introduced the SqlTester library, which can be downloaded at the bottom of this post.  I also showed a series of classes that implemented IDataRecord and IDataReade to allow the creation …

Simulating SQL Server (Part 2)

If you haven’t read it already, why not start with Simulating SQL Server (Part 1)? Last time we looked at creating a RecordSetDefinition  as a collection of ColumnDefinition s.  Once we had a way of defining what a recordset looks like, we then were able to create an ObjectRecord . The next step is to collect those …

Simulating SQL Server (Part 1)

In my last post, I talked about creating random values for all kinds of interesting types.  One of the biggest complaints I get when encouraging developers to implement unit tests (or dare I say even start thinking about TDD as a development methodology) is that testing code that accesses databases is a huge pain.  For …

Generating Randomness

My new year’s resolution for this year was to not only start blogging more frequently but also to Open Source some of our core libraries that I’ve worked on over the years. In preparation for that though it’s important I cover some of the basics and explain the reasoning behind some of the code we’ll …

The problem with null checking

The .NET framework is littered with the following code (e.g. from the System.Guid class):

A common scenario when creating a publicly accessible method is to validate the parameters being passed into the method and throw an exception when something is amiss.  I used this example as Guid.ParseExact was only added in .NET 4, showing …

Delivering code as a team

Anyone who knows me will tell you how important I take any opportunity to talk to young people before they enter the workforce, so when the University of Manchester invited me to give a guest lecture to their Advanced Computer Science masters students I jumped at the chance. So at 11AM on Wednesday the 18th …

Statics and Generics

So statics are generally considered evil, the enemy of TDD and IOC, and at odds with the purity of OO design. Shame they’re so incredibly fast! Whilst we’re talking about the TDD issue, I recommend you stop for a moment and go and take a look at the Fakes Framework added to VS11. Fakes is …