machine/machine.specifications — pull request #114 by mdwhatcott (2012-08-01 21:34:03+00:00)
Title: Bug Fix for ShouldBeLike

The ShouldBeLike extension method is a wonderful addition to the ShouldExtensionMethods class. I've noticed, however, that when comparing two objects of the same type (neither is an anonymous object) that if any of the properties were set to null a NullReferenceException was thrown, which meant that the test always failed. I would expect the comparison to succeed if both objects shared the same values for corresponding properties regardless of whether the values are null or otherwise. The exception was being thrown in a recursive call to ShouldExtensionMethods.ShouldBeLikeInternal(...). This pull request addresses this concern. I included the specs I wrote to expose the behavior as well as the fix in the ShouldBeLikeInternal method. Let me know what you think.