Gojko Adzic posted today on his blog about Steve Freeman's unit-testing trick, which helped make it crystal clear why the date comparison in the unit test failed. Here is the blog post describing the trick - it is not long.
The key part of the trick is this method (in Java), which overrides ToString() on a particular instance of the Date class.
private Date namedDate(final String name, final Date date) {
return new Date(date.getTime()){
@Override
public String toString() {
return name;
}
};
}
It appears that this method uses a facility of Java language that doesn't have a match in C# (or at least one that I know of). If you could show me how to do the same trick in C#, that would be awesome.