public List <Contractor> GetContractorsAged(DateTime minDate, DateTime?maxDate) { Fail.IfNotMidnight(minDate, "minDate must be a midnight"); Fail.IfNotMidnight(maxDate, "maxDate must be a midnight"); // WARN: Below is sample code with no sense at all return(new List <Contractor>(0)); }
public void IfNotMidnight() { // ARRANGE DateTime notMidnight = DateTime.Today.AddSeconds(1000); // ACT var exception = Assert.Throws <DesignByContractViolationException>( () => Fail.IfNotMidnight(notMidnight, "date should have no hour nor second") ); // ASSERT Assert.That(exception.Message, Is.EqualTo("date should have no hour nor second")); }
public void IfNotMidnightSuccessWithNull() { // ACT Fail.IfNotMidnight(null, "date should have no hour nor second"); }
public void IfNotMidnightSuccess() { // ACT Fail.IfNotMidnight(DateTime.Today, "date should have no hour nor second"); }