Пример #1
0
        public void ReadChildProperty_child_property_is_defined_build_child()
        {
            var graph = new PluginGraph();

            graph.FindFamily(typeof(Rule)).AddPlugin(typeof(ComplexRule));

            MemoryInstanceMemento memento = ComplexRule.GetMemento();

            memento.SetProperty(XmlConstants.PLUGGED_TYPE, typeof(ComplexRule).AssemblyQualifiedName);
            MemoryInstanceMemento carMemento = MemoryInstanceMemento.CreateReferencedInstanceMemento("GrandPrix");

            memento.AddChild("car", carMemento);

            var instance = (IStructuredInstance)memento.ReadInstance(graph, typeof(Rule));
            var child    = (ReferencedInstance)instance.GetChild("car");

            Assert.AreEqual("GrandPrix", child.ReferenceKey);
        }