Exemplo n.º 1
0
        public void should_not_return_cyclic_references_in_serialize_mode(CyclicRoot root, string name)
        {
            var members = new ObjectNode(new Context(Options.Create(), Mode.Serialize, "xml"), null,
                                         new SimpleValue(root, typeof(CyclicRoot).ToCachedType()), null, null).ToList();

            var child = members.GetNode(name);

            child.ShouldTotal(1);
            child.ShouldNotContain(x => x.Name == "item1");
            child.ShouldContainNode("item2");
        }
Exemplo n.º 2
0
        public void should_return_attribute_metadata(string name, bool exists)
        {
            var children = new ObjectNode(new Context(Options.Create(x => x.IncludePublicFields()),
                                                      Mode.Serialize, "xml"), null, new SimpleValue(new MemberMetadata
            {
                EmptyProperty = "", Property = "", Field = "", EmptyField = ""
            },
                                                                                                    typeof(MemberMetadata).ToCachedType()), null, null);

            children.GetNode(name).Metadata.Contains <XmlAttributeAttribute>().ShouldEqual(exists);
        }
Exemplo n.º 3
0
        public void should_not_return_cyclic_references_in_serialize_mode(CyclicRoot root, string name)
        {
            var members = new ObjectNode(new Context(Options.Create(), Mode.Serialize, "xml"), null,
                                         new SimpleValue(root, typeof(CyclicRoot).ToCachedType()), null, null).ToList();

            var child    = members.GetNode(name);
            var children = child.ToList();

            children.ShouldTotal(1);
            children.Cast <NodeBase>().ShouldAllMatch(x => x.Value != root);
        }