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 [...]
Archive for the ‘TDD’ Category
Unit testing for managed memory leakage
Posted in Design Patterns, Memory Management, Problems and Solutions, TDD, Threading, tagged c#, garbage collection, GC - Memory Management, jet brains, performance, unit testing, weak references on December 31, 2011 | Leave a Comment »
Building a news aggregator module for a trading platform -Introduction
Posted in 2. Application Development, Agile, Architecture, Cool Tools, Problems and Solutions, TDD, Traders Tools, tagged agile, communication, development team, iterations, lifecycle, news aggregator, TDD, trading, uat on December 12, 2011 | 1 Comment »
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, [...]
Setting up Castle Windsor IOC for web applications
Posted in Architecture, Castle Windsor, Design Patterns, IOC, NHibernate, ORM, TDD, tagged c#, Castle Windsor, Design Patterns, domain, IOC, loosely coupled, Mapping files, NHibernate, ORM, separation of concerns, test driven design, web architecture on September 27, 2010 | 2 Comments »
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 [...]
Testing MS asp.net code behind
Posted in Architecture, Castle Windsor, Design Patterns, TDD, tagged Castle Windsor, Design Patterns, IOC, loosely coupled, separation of concerns, test driven design, web architecture on August 22, 2010 | 1 Comment »
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 [...]
Setting up the Castle Windsor IOC framework for basic dependency injection
Posted in Castle Windsor, IOC, TDD, tagged Castle Windsor, Design Patterns, IOC, repository pattern on August 1, 2010 | Leave a Comment »
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 [...]
Unit Testing and TDD
Posted in Architecture, TDD, tagged expected exceptions, loosely coupled, separation of concerns, test driven design, testing exceptions, unit of work on May 18, 2010 | Leave a Comment »
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 [...]
Object Equality
Posted in Back to basics - C#, Design Patterns, TDD, tagged Design Patterns, gethashcode, overriding equals, test driven design on May 2, 2010 | 1 Comment »
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 [...]
Testing for expected exceptions
Posted in TDD, tagged expected exceptions, test driven design, testing exceptions on April 17, 2010 | 1 Comment »
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, [...]
Testing private, protected and internal methods
Posted in TDD, tagged internal, private, protected, test driven design on April 17, 2010 | 1 Comment »
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 [...]
NHibernate sessions and units of work
Posted in Architecture, NHibernate, ORM, TDD, tagged loosely coupled, NHibernate, ORM, separation of concerns, sessions, unit of work, web architecture on April 5, 2010 | Leave a Comment »
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 [...]