예제 #1
0
        /// <summary>
        /// Validacia s default validatorom a defaultnym setom pravidiel
        /// </summary>
        /// <param name="path"></param>
        private void Validate(string path)
        {
            Log("Reading input file.. ");
            var kv = KVDPH.LoadFromFile(path);
            LogLn("OK", false);

            Log("Creating validation rules set.. ");
            var rules = new DefaultValidationSetFactory().ValidationSet;
            LogLn("OK", false);
            LogLn("Number of rules: " + rules.Count);

            LogLn("Validating..");
            var validator = new DefaultValidator();
            validator.AddObserver(this);
            var result = validator.Validate(kv, rules);
            LogLn("Validating completed.");
            if (result.Count == 0)
            {
                LogLn("Validation passed with no problems or warnings.");
                return;
            }
            else
            {
                LogLn("Number of problems: " + result.Count);
                foreach (var problem in result)
                    HandleProblem(problem);
                Log(Environment.NewLine, false);
            }
        }