public void Should_be_possible_to_create_an_instance_of_OvalDefinitionsValidationResult_using_default_constructor()
        {
            var instanceOfOvalDefintionsValidationResult = new OvalDefinitionsValidationResult();

            Assert.IsTrue(instanceOfOvalDefintionsValidationResult.IsValid, "When no error list was passed, the IsValid property must TRUE.");
            Assert.IsNull(instanceOfOvalDefintionsValidationResult.ErrorList, ERROR_LIST_PROPERTY_SHOULD_BE_NULL);
        }
 private void ValidationResultShouldBeValidFor(OvalDefinitionsValidationResult validationResult)
 {
     Assert.IsTrue(validationResult.IsValid, "The Oval Definitions validation result must be TRUE.");
     var validationErrors = validationResult.ErrorList;
     var emptyErrorList = validationErrors == null || validationErrors.Count() == 0;
     if (!emptyErrorList)
         Assert.Fail(AN_EMPTY_ERROR_LIST_EXPECTED_FAIL_MSG, validationErrors.Count(), validationErrors.First());
 }
Ejemplo n.º 3
0
        private void ValidationResultShouldBeValidFor(OvalDefinitionsValidationResult validationResult)
        {
            Assert.IsTrue(validationResult.IsValid, "The Oval Definitions validation result must be TRUE.");
            var validationErrors = validationResult.ErrorList;
            var emptyErrorList   = validationErrors == null || validationErrors.Count() == 0;

            if (!emptyErrorList)
            {
                Assert.Fail(AN_EMPTY_ERROR_LIST_EXPECTED_FAIL_MSG, validationErrors.Count(), validationErrors.First());
            }
        }
        public void If_OvalDefinitionsValidationResult_was_created_passing_an_empty_error_list_the_validation_result_must_be_TRUE()
        {
            var anEmptySchemaErrorsList = new String[] { };

            var instanceOfOvalDefintionsValidationResult = new OvalDefinitionsValidationResult(anEmptySchemaErrorsList);

            Assert.IsTrue((bool)instanceOfOvalDefintionsValidationResult.IsValid, "If an empty error list was passed, the validation result must be TRUE.");
            var schemaErrorsList = instanceOfOvalDefintionsValidationResult.ErrorList;

            Assert.IsNotNull(schemaErrorsList, ERROR_LIST_PROPERTY_SHOULD_BE_NULL);
            Assert.AreEqual(0, schemaErrorsList.Count(), NO_ITEMS_ARE_EXPECTED_FAIL_MSG);
        }
        public void If_OvalDefinitionsValidationResult_was_created_passing_a_nonempty_erros_list_the_validation_result_must_be_FALSE()
        {
            var anSchemaErrorsList = new String[] { "Schema Error 1", "Schema Error 2" };

            var instanceOfOvalDefintionsValidationResult = new OvalDefinitionsValidationResult(anSchemaErrorsList);

            Assert.IsFalse((bool)instanceOfOvalDefintionsValidationResult.IsValid, "If a non-empty schema error list was passed, the expected value for IsValid property is FALSE.");
            var schemaErrorsList = instanceOfOvalDefintionsValidationResult.ErrorList;

            Assert.IsNotNull(schemaErrorsList, ERROR_LIST_PROPERTY_SHOULD_NOT_BE_NULL);
            Assert.AreEqual(2, schemaErrorsList.Count(), "Unexpected errors count was found in SchemaErrors property.");
            Assert.AreEqual("Schema Error 1", schemaErrorsList.ElementAt(0), UNEXPECTED_ERROR_ELEMENT_WAS_FOUND);
            Assert.AreEqual("Schema Error 2", schemaErrorsList.ElementAt(1), UNEXPECTED_ERROR_ELEMENT_WAS_FOUND);
        }