public void IsAfternoonTestCase() { var dateTime = new DateTime( 2014, 10, 10, 13, 0, 0 ); var actual = dateTime.IsAfternoon(); Assert.IsTrue( actual ); dateTime = new DateTime( 2014, 10, 10, 10, 0, 0 ); actual = dateTime.IsAfternoon(); Assert.IsFalse( actual ); }
public void IsAfternoon() { // Type var @thisMorning = new DateTime(2014, 04, 12, 8, 0, 0); var @thisAfternoon = new DateTime(2014, 04, 12, 17, 0, 0); // Exemples bool result1 = @thisMorning.IsAfternoon(); // return false; bool result2 = @thisAfternoon.IsAfternoon(); // return true; // Unit Test Assert.IsFalse(result1); Assert.IsTrue(result2); }