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

            // Act.
            argument.IsNotInstanceOfType(typeof(string));

            // Assert.
            Assert.AreEqual(1, argument.ValidationPredicates.Count());
            Assert.IsInstanceOfType(argument.ValidationPredicates.First(), typeof(NotInstanceOfTypeValidationPredicate <object>));
        }
        public void AddNotInstanceOfTypeValidationPredicate()
        {
            // Arrange.
            ValidatableArgument<object> argument = new ValidatableArgument<object>("argument", new object());

            // Act.
            argument.IsNotInstanceOfType(typeof(string));

            // Assert.
            Assert.AreEqual(1, argument.ValidationPredicates.Count());
            Assert.IsInstanceOfType(argument.ValidationPredicates.First(), typeof(NotInstanceOfTypeValidationPredicate<object>));
        }
示例#3
0
        public void RunInExpectedTime()
        {
            // Arrange.
            ValidatableArgument <string> argument = new ValidatableArgument <string>("argument", "value");

            // Act & Assert.
            Ensure.ActionRunsInExpectedTime(
                () =>
            {
                argument.IsNotInstanceOfType(typeof(string));
            },
                PerformanceConstants.ValidationPredicateExecutionCount,
                PerformanceConstants.ValidationPredicateTotalExecutionExpectedTime);
        }
        public void RunInExpectedTime()
        {
            // Arrange.
            ValidatableArgument<string> argument = new ValidatableArgument<string>("argument", "value");

            // Act & Assert.
            Ensure.ActionRunsInExpectedTime(
                () =>
                {
                    argument.IsNotInstanceOfType(typeof(string));
                },
                PerformanceConstants.ValidationPredicateExecutionCount,
                PerformanceConstants.ValidationPredicateTotalExecutionExpectedTime);
        }