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));
        }
Exemple #2
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"));
        }
Exemple #3
0
 public void IfNotMidnightSuccessWithNull()
 {
     // ACT
     Fail.IfNotMidnight(null, "date should have no hour nor second");
 }
Exemple #4
0
 public void IfNotMidnightSuccess()
 {
     // ACT
     Fail.IfNotMidnight(DateTime.Today, "date should have no hour nor second");
 }