Category Archives: tdd

Getting value out of your unit tests

Unit tests, with TDD in particular, are the most efficient way I’ve found in creating behavior for my application.  For lasting value, beyond just the safety net of “if I change something, will something break”, requires extra discipline, and a … Continue reading 

| 11 Comments

Do not test private methods

You should only be testing public methods. Private methods are an implementation detail of the object and are subject to heavy change, etc.  Any class, including test fixtures, that care about private methods on another object exhibit the “Inappropriate intimacy” … Continue reading 

| Leave a comment

BDD and Parameterized testing

Although I really like Astels style BDD still use a lot of parameterized testing and though I should give you an example why, using XUnit.net. Lets say we’re testing simple SPECIFICATION style rules, in BDD we might write: [Concerning(typeof(ValidEmailRule<TestEntity>))]public class When_using_rule_on_a_null_string : … Continue reading 

Also posted in monorail aspnet | Leave a comment

Where TDD fails for me

TDD is by far the sharpest tool in my belt.  The simplicity of client-driven design combined with the safety net of unit tests allow me to build software at a remarkable constant pace.  At the edges of most of the … Continue reading 

| 7 Comments

Lazy Loaded Interceptors

Patterns of Enterprise Application Architecture defines Lazy Load as: An object that doesn’t contain all of the data you need but knows how to get it.   A while back I was trying to figure out how to lazy load … Continue reading 

Also posted in svn nant cruisecontrol | 4 Comments

Mocking Queryables

Recently, we’ve been mocking out IQueryable’s as return values, which had led to setups that look like the following… programs.setup_result_for(x => x.All()).Return(new List<IProgram> {active_program,inactive_program}.AsQueryable()); I just switched over to the following syntax… by creating an extension method. programs.setup_result_for(x => x.All()).will_return(active_program,inactive_program); … Continue reading 

Also posted in microsoft tools monorail | 36 Comments

BDD – Files/Folders/Namespaces (BDD)

Files/FoldersOne thing that can be troublesome when moving to a BDD style approach is how to organize your files and folders, so far I’ve tried two approaches: One class in each file – So if you have When_associating_an_order_with_a_customer and When_associating_an_order_with_a_preferred_customer then … Continue reading 

Also posted in general linux ubuntu | 5 Comments

Acceptable test failures

As Derick Bailey pointed out in my last post, one of the annoyances with ReSharper is the NotImplementedException it puts in when you generate a method.  Going from the TDD side, this is exactly what we don’t want when we’re … Continue reading 

| 5 Comments

Three simple Rhino Mocks rules

In previous versions of Rhino Mocks, the Record/Replay model was the only way to create and verify mocks.  You would have an area that set up expectations in a record mode, then the replay mode would verify your expectations.  What … Continue reading 

| 13 Comments

A TDD investment addendum

I completely left out one very important tip in my top 10 tips to get a return on your TDD investment: Take advantage of pair-programming. Pair programming is a great teaching device, as it lets two people go back and … Continue reading 

| Leave a comment