示例#1
0
        public void Should_Return_False_When_Source_Is_Within_Range(int min, int max)
        {
            Assert.False(ComparableStructCondition().Not.WithinRange(min, max));

            Assert.False(NullableComparableStructCondition().Not.WithinRange(min, max));

            Assert.False(ComparableClassCondition().Not.WithinRange(ComparableTestObject.New(min), ComparableTestObject.New(max)));
        }
示例#2
0
        public void Result_Should_Be_True_When_Source_Is_Not_Within_Range(int min, int max)
        {
            Assert.True(ComparableStructCondition().Not.WithinRange(min, max).Result);

            Assert.True(ComparableNullableStructCondition().Not.WithinRange(min, max).Result);

            Assert.True(ComparableClassCondition().Not.WithinRange(ComparableTestObject.New(min), ComparableTestObject.New(max)).Result);
        }
示例#3
0
        public void Should_Throw_ConditionEvaluationFailedException_When_Min_Or_Max_Is_Null()
        {
            var exception = Assert.Throws <ConditionEvaluationFailedException>(() => ComparableNullableStructCondition().WithinRange(null, 6).Result);

            Assert.IsType <ArgumentNullException>(exception.InnerException);

            exception = Assert.Throws <ConditionEvaluationFailedException>(() => ComparableNullableStructCondition().WithinRange(4, null).Result);
            Assert.IsType <ArgumentNullException>(exception.InnerException);

            exception = Assert.Throws <ConditionEvaluationFailedException>(() => ComparableNullableStructCondition().WithinRange(null, null).Result);
            Assert.IsType <ArgumentNullException>(exception.InnerException);

            exception = Assert.Throws <ConditionEvaluationFailedException>(() => ComparableNullableStructCondition().Not.WithinRange(null, 6).Result);
            Assert.IsType <ArgumentNullException>(exception.InnerException);

            exception = Assert.Throws <ConditionEvaluationFailedException>(() => ComparableNullableStructCondition().Not.WithinRange(4, null).Result);
            Assert.IsType <ArgumentNullException>(exception.InnerException);

            exception = Assert.Throws <ConditionEvaluationFailedException>(() => ComparableNullableStructCondition().Not.WithinRange(null, null).Result);
            Assert.IsType <ArgumentNullException>(exception.InnerException);

            exception = Assert.Throws <ConditionEvaluationFailedException>(() => ComparableClassCondition().WithinRange(null, ComparableTestObject.New(6)).Result);
            Assert.IsType <ArgumentNullException>(exception.InnerException);

            exception = Assert.Throws <ConditionEvaluationFailedException>(() => ComparableClassCondition().WithinRange(ComparableTestObject.New(4), null).Result);
            Assert.IsType <ArgumentNullException>(exception.InnerException);

            exception = Assert.Throws <ConditionEvaluationFailedException>(() => ComparableClassCondition().WithinRange(null, null).Result);
            Assert.IsType <ArgumentNullException>(exception.InnerException);

            exception = Assert.Throws <ConditionEvaluationFailedException>(() => ComparableClassCondition().Not.WithinRange(null, ComparableTestObject.New(6)).Result);
            Assert.IsType <ArgumentNullException>(exception.InnerException);

            exception = Assert.Throws <ConditionEvaluationFailedException>(() => ComparableClassCondition().Not.WithinRange(ComparableTestObject.New(4), null).Result);
            Assert.IsType <ArgumentNullException>(exception.InnerException);

            exception = Assert.Throws <ConditionEvaluationFailedException>(() => ComparableClassCondition().Not.WithinRange(null, null).Result);
            Assert.IsType <ArgumentNullException>(exception.InnerException);
        }