public void IsNowLunchBreak_should_return_indeterminate_result_if_original_behavior_is_performed_internally() { using (new IndirectionsContext()) { // Arrange IndirectionsContext. ExcludeGeneric(). DefaultBehavior = IndirectionBehaviors.Fallthrough; // Act, Assert Assert.DoesNotThrow(() => LifeInfo.IsNowLunchBreak()); } }
public void IsNowLunchBreak_should_rethrow_any_exception_if_an_exception_is_thrown_internally() { using (new IndirectionsContext()) { // Arrange IndirectionsContext. ExcludeGeneric(). DefaultBehavior = IndirectionBehaviors.NotImplemented; // Act, Assert Assert.Throws <NotImplementedException>(() => LifeInfo.IsNowLunchBreak()); } }
public void IsNowLunchBreak_should_return_false_when_13_oclock() { using (new IndirectionsContext()) { // Arrange PDateTime.NowGet().Body = () => new DateTime(2013, 12, 13, 13, 00, 00); // Act var result = LifeInfo.IsNowLunchBreak(); // Assert Assert.IsFalse(result); } }
public void IsNowLunchBreak_should_return_false_if_default_value_is_returned_internally() { using (new IndirectionsContext()) { // Arrange IndirectionsContext. ExcludeGeneric(). DefaultBehavior = IndirectionBehaviors.DefaultValue; // Act var result = LifeInfo.IsNowLunchBreak(); // Assert Assert.IsFalse(result); } }
public void IsNowLunchBreak_should_return_false_when_11_oclock() { // `IndirectionsContext` can minimize the influence of the API replacement. using (new IndirectionsContext()) { // Arrange // Replace `DateTime.Now` body. Hereafter, `DateTime.Now` will return only `2013/12/13 11:00:00`. PDateTime.NowGet().Body = () => new DateTime(2013, 12, 13, 11, 00, 00); // Act var result = LifeInfo.IsNowLunchBreak(); // Assert Assert.IsFalse(result); } }