Feeds:
Posts
Comments

Archive for the ‘TDD’ Category

It might seem a strange thing to do. Firstly can there be managed memory leakage? And secondly how can you unit test for this? I’ll put this into context and then all will become clear. I came across this interesting problem recently when playing around with a set of streaming real time data and attaching [...]

Read Full Post »

I am working on a project where I going to build a news aggregator which takes certain keywords and searches a predefined set of websites, company statements etc for stories or blog posts that have that keyword in it. The keywords are mostly a combination of company names or stock ticker codes and mood indicators, [...]

Read Full Post »

I recently wrote a post about how to set up CW’s IOC container for applications. This post covered the most basic implementation to get an IOC container up and running. It is now time to cover a proper architecture for using IOC specifically for web applications / sites. The main problem with the previous implementation [...]

Read Full Post »

Testing Microsoft’s web forms (asp.net) UI. Microsoft’s web form architecture is not particularly good for testing. The event driven architecture of ‘code behind’ means lots of logic gets stored in C# code that is tightly bound to the HTML code. This means you can’t write purely C# unit tests for it. The best solution is [...]

Read Full Post »

Using an Inversion of Control (IOC) framework such as Castle Windsor is very easy. Here I will show how to set up a very basic dependency injection using an external configuration file. The architecture in this example is a basic repository pattern allowing the (in this case the database) repository to be loosely coupled from [...]

Read Full Post »

After looking around for a decent book purely on TDD and Unit testing I realised there is a surprising lack of industry standardisation on this extremely popular topic. There are lots of tips and tricks but as of yet I have not found a complete works or treatise covering the subject. I don’t propose to [...]

Read Full Post »

Whilst developing applications and especially while unit testing it is often required to test whether an object t is equal to some other object of the same type. It is almost always a value type comparison that is required. This means we need to check to see if the fields on the objects match and [...]

Read Full Post »

My last post detailed how to test methods that are not public. The example code I used was a method that divides one decimal by another. I thought this a good chance to demonstrate how to test for expected Exceptions. To refresh our memories, the method we are testing is this: public decimal PublicDivide(decimal numerator, [...]

Read Full Post »

I have seen a lot of debate about testing methods that are private, internal or protected. There are different arguments for both sides of the argument of whether these methods should be tested or not. I like to have a fine grained test coverage as possible and as I like to keep methods as short [...]

Read Full Post »

My understanding of the NHibernate Session is that in the case of a web application, the ISession should be created and destroyed with each HttpRequest. This is probably the most efficient use of the session and enables easy use of lazy loading within a single request. Sessions do not require much overhead to create and [...]

Read Full Post »

Older Posts »

Follow

Get every new post delivered to your Inbox.