示例#1
0
        public void RunInExpectedTime()
        {
            // Arrange.
            ValidatableArgument <double> argument =
                new ValidatableArgument <double>("argument", 5);

            // Act & Assert.
            Ensure.ActionRunsInExpectedTime(
                () =>
            {
                argument.IsPositiveInfinity();
            },
                PerformanceConstants.ValidationPredicateExecutionCount,
                PerformanceConstants.ValidationPredicateTotalExecutionExpectedTime);
        }
        public void RunInExpectedTime()
        {
            // Arrange.
            ValidatableArgument<float> argument =
                new ValidatableArgument<float>("argument", 5);

            // Act & Assert.
            Ensure.ActionRunsInExpectedTime(
                () =>
                {
                    argument.IsPositiveInfinity();
                },
                PerformanceConstants.ValidationPredicateExecutionCount,
                PerformanceConstants.ValidationPredicateTotalExecutionExpectedTime);
        }
        public void AddEqualValidationPredicateWithFloatPositiveInfinityBound()
        {
            // Arrange.
            ValidatableArgument<float> argument =
                new ValidatableArgument<float>("argument", 5);

            // Act.
            argument.IsPositiveInfinity();

            // Assert.
            Assert.AreEqual(1, argument.ValidationPredicates.Count());
            EqualValidationPredicate<float> validationPredicate = argument.ValidationPredicates.First() as EqualValidationPredicate<float>;
            Assert.IsNotNull(validationPredicate);
            Assert.AreEqual(validationPredicate.Bound, float.PositiveInfinity);
        }
示例#4
0
        public void AddEqualValidationPredicateWithDoublePositiveInfinityBound()
        {
            // Arrange.
            ValidatableArgument <double> argument =
                new ValidatableArgument <double>("argument", 5);

            // Act.
            argument.IsPositiveInfinity();

            // Assert.
            Assert.AreEqual(1, argument.ValidationPredicates.Count());
            EqualValidationPredicate <double> validationPredicate = argument.ValidationPredicates.First() as EqualValidationPredicate <double>;

            Assert.IsNotNull(validationPredicate);
            Assert.AreEqual(validationPredicate.Bound, double.PositiveInfinity);
        }