Exemple #1
0
        public void ReturnTrueAndMatchMessage_WhenArgumentIsObjectAndTypeIsString()
        {
            // Arrange.
            Type type = typeof(string);
            NotInstanceOfTypeValidationPredicate <object> validationPredicate = new NotInstanceOfTypeValidationPredicate <object>(type);

            // Act.
            IValidationPredicateResult result = validationPredicate.Match(new object());

            // Assert.
            Assert.IsTrue(result.IsMatch);
            Assert.AreEqual("The argument is not instance of type <System.String>.", result.Message);
        }
Exemple #2
0
        public void ReturnTrueAndMatchMessage_WhenArgumentIsNullAndTypeIsArrayList()
        {
            // Arrange.
            Type type = typeof(ArrayList);
            NotInstanceOfTypeValidationPredicate <string> validationPredicate = new NotInstanceOfTypeValidationPredicate <string>(type);

            // Act.
            IValidationPredicateResult result = validationPredicate.Match(null);

            // Assert.
            Assert.IsTrue(result.IsMatch);
            Assert.AreEqual("The argument is not instance of type <System.Collections.ArrayList>.", result.Message);
        }
Exemple #3
0
        public void ReturnFalseAndUnatchMessage_WhenArgumentIsStringAndTypeIsObject()
        {
            // Arrange.
            Type type = typeof(object);
            NotInstanceOfTypeValidationPredicate <string> validationPredicate = new NotInstanceOfTypeValidationPredicate <string>(type);

            // Act.
            IValidationPredicateResult result = validationPredicate.Match("asdf");

            // Assert.
            Assert.IsFalse(result.IsMatch);
            Assert.AreEqual("The argument is instance of type <System.Object>.", result.Message);
        }
        public void ReturnTrueAndMatchMessage_WhenArgumentIsObjectAndTypeIsString()
        {
            // Arrange.
            Type type = typeof(string);
            NotInstanceOfTypeValidationPredicate<object> validationPredicate = new NotInstanceOfTypeValidationPredicate<object>(type);

            // Act.
            IValidationPredicateResult result = validationPredicate.Match(new object());

            // Assert.
            Assert.IsTrue(result.IsMatch);
            Assert.AreEqual("The argument is not instance of type <System.String>.", result.Message);
        }
        public void ReturnTrueAndMatchMessage_WhenArgumentIsNullAndTypeIsArrayList()
        {
            // Arrange.
            Type type = typeof(ArrayList);
            NotInstanceOfTypeValidationPredicate<string> validationPredicate = new NotInstanceOfTypeValidationPredicate<string>(type);

            // Act.
            IValidationPredicateResult result = validationPredicate.Match(null);

            // Assert.
            Assert.IsTrue(result.IsMatch);
            Assert.AreEqual("The argument is not instance of type <System.Collections.ArrayList>.", result.Message);
        }
        public void ReturnFalseAndUnatchMessage_WhenArgumentIsStringAndTypeIsObject()
        {
            // Arrange.
            Type type = typeof(object);
            NotInstanceOfTypeValidationPredicate<string> validationPredicate = new NotInstanceOfTypeValidationPredicate<string>(type);

            // Act.
            IValidationPredicateResult result = validationPredicate.Match("asdf");

            // Assert.
            Assert.IsFalse(result.IsMatch);
            Assert.AreEqual("The argument is instance of type <System.Object>.", result.Message);
        }