Ejemplo n.º 1
0
        public void TestShorthandConfiguration() {
            var root = new ShorthandRoot(File.ReadAllText(@"shorthand.xml"));

            foreach (var error in root.Errors()) {
                Console.WriteLine(error);
            }

            Assert.AreEqual(0, root.Errors().Count());
            Assert.AreEqual(4, root.Signatures.Count);
            Assert.AreEqual(2, root.Targets.Count);
            Assert.AreEqual(6, root.Methods.Count);
        }
Ejemplo n.º 2
0
        protected void LoadShorthand(string cfg) {
            this.Clear(Events);

            Shorthand = new ShorthandRoot(cfg, Reader, Parser);

            if (Shorthand.Warnings().Any()) {
                foreach (var warning in Shorthand.Warnings()) {
                    Events.Warning(warning);
                }
            }

            if (Shorthand.Errors().Any()) {
                foreach (var error in Shorthand.Errors()) {
                    Events.Error(error);
                }
                return;
            }

            Shorthand.InitializeMethodDataLookup();
        }
Ejemplo n.º 3
0
 CfgNode Load(
     INode node,
     string parent,
     ISerializer serializer,
     CfgEvents events,
     IDictionary<string, IValidator> validators,
     ShorthandRoot shorthand,
     Dictionary<string, string> parameters
 ) {
     this.Clear(events);
     Shorthand = shorthand;
     Validators = validators;
     Serializer = serializer;
     LoadProperties(node, parent, parameters);
     LoadCollections(node, parent, parameters);
     PreValidate();
     ValidateBasedOnAttributes();
     ValidateListsBasedOnAttributes(node.Name);
     Validate();
     PostValidate();
     return this;
 }