コード例 #1
0
        public void ConditionHoldsShouldThrowExceptionWhenContextIsNotProvided()
        {
            // Arrange
            var now       = DateTime.UtcNow;
            var condition = new FromTimeOfDayCondition(now.AddHours(-1).TimeOfDay);

            // Act

            // Assert
            Assert.Throws <ArgumentNullException>(() => condition.Holds(null));
        }
コード例 #2
0
        public void ConditionHoldsShouldReturnFalseWhenCurrentTimeIsLessThanTimeOfDay()
        {
            // Arrange
            var now       = DateTime.UtcNow;
            var condition = new FromTimeOfDayCondition(now.AddHours(1).TimeOfDay);
            var context   = new Context(now, null, null);

            // Act
            var conditionHolds = condition.Holds(context);

            // Assert
            Assert.False(conditionHolds);
        }
コード例 #3
0
        public void ConditionHoldsShouldReturnTrueWhenCurrentTimeIsEqualToFromTimeOfDay()
        {
            // Arrange
            var now       = DateTime.UtcNow;
            var condition = new FromTimeOfDayCondition(now.TimeOfDay);
            var context   = new Context(now, null, null);

            // Act
            var conditionHolds = condition.Holds(context);

            // Assert
            Assert.True(conditionHolds);
        }