Today I read Roy Osherove's blog post "Two Different ways to create bad logic in unit tests". It's an interesting article that covers logic included in many unit tests, is it acceptable to compare a returned string value using a comparison value built via string concatenation? It is perfectly possible that an issue introduced by the concatenation process is duplicated in both the code and the unit test - more often than not the logic has been cut / pasted from the code base into the unit test anyway.
As an example directly from Roy's blog consider the following code:
Thinking this through, it makes perfect sense, the following could be a better test:
Could this be the answer? It certainly removes any possible duplicated logic that may hide issues in the string manulipation, but would it be workable in a more complex example?