Reflection
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 […]
The problem with null checking
The .NET framework is littered with the following code (e.g. from the System.Guid class): public static Guid ParseExact(String input, String format) { if (input == null) throw new ArgumentNullException(“input”); if (format == null) throw new ArgumentNullException(“format”); if (format.Length != 1) { // all acceptable format strings are of length 1 throw new FormatException(…); } … […]