Ejemplo n.º 1
0
        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());
            }
        }
Ejemplo n.º 2
0
        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());
            }
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        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);
            }
        }