Mike had to model answers. Yes or no answers, date and time answers - all sorts of answers. One catch was that any answer could be “missing” or could be “empty”. Both values had distinct meanings in the domain. An interface definition fell out of the early iterative design work:public interface IAnswer
{
bool IsMissing { get; }
bool IsEmpty { get; }
}
Mike was prepared to implement a DateTimeAnswer class, but first a test:[TestMethod]
public void Can_Represent_Empty_DateTimeAnswer()
{
DateTimeAnswer emptyAnswer = new DateTimeAnswer();
Assert.IsTrue(emptyAnswer.IsEmpty);
}
After a little work, Mike had a class...