Low level unit testing sucks. It sucks even more when you realize for every 100 properties that you test only one of them is going to have a bug. A nasty, impossible to find bug, that prompted your lead to have you write the stupid property tests in the first place.
Test Monkey is an automatic Unit Test Generator for .NET/Silverlight. It is designed to write the trivial unit tests that, while very valuable, are incredibly tedious to write manually.
Test Monkey Basic Tests
- All constructors are successful or throw ArgumentException
- Setting a value will throw an ArgumentException or set the value
- Setting a value to itself will not throw
- Setting a value to null will throw an ArgumentNullException or set the value (Exception, strings can be changed from null to "")
- Reading a property twice in a row will return the same value both times.
- Creating and then nulling an object will allow it to be garbage collected.
Test Monkey Interface Tests
- Clone doesn't throw
- New properties are equal to original
IComparable and IComparable<T>
- IComparable.Compare (equals, greater-than, and less-than)
- IComparable.Compare null check
- IComparable<T>.Compare (equals, greater-than, and less-than)
- IComparable<T>.Compare null check (if applicable)
- Base case doesn't throw
- Calling a second time doesn't throw
- Repeat with each constructor
- Begin/End pair doesn't throw
- Begin/Cancel pair doesn't throw
- IEquatable.Equals (equals, not equals)
- IEquatable.Equals null check (if applicable)
- Object.Equals(object, object)
- Raises an event when the value changes
- Doesn't eaise an event for an unchanged being set. (Note, other properties may be raised. This is to support calculated properties where you don't want the expense of seeing if they actaully changed.)