Ejemplo n.º 1
0
        public void ShouldWriteArrayForArrayMapping()
        {
            var mapping = CollectionMapping.Array();

            writer.VerifyXml(mapping)
            .RootElement.HasName("array");
        }
Ejemplo n.º 2
0
        public void ShouldNotWriteCollectionTypeWhenEmpty()
        {
            var mapping = CollectionMapping.Array();

            mapping.Set(x => x.CollectionType, Layer.Defaults, TypeReference.Empty);
            writer.VerifyXml(mapping)
            .DoesntHaveAttribute("collection-type");
        }
Ejemplo n.º 3
0
        public void ShouldWriteElement()
        {
            var mapping = CollectionMapping.Array();

            mapping.Set(x => x.Element, Layer.Defaults, new ElementMapping());

            writer.VerifyXml(mapping)
            .Element("element").Exists();
        }
Ejemplo n.º 4
0
        public void ShouldWriteIndexElement()
        {
            var mapping = CollectionMapping.Array();

            mapping.Set(x => x.Index, Layer.Defaults, new IndexMapping());

            writer.VerifyXml(mapping)
            .Element("index").Exists();
        }
Ejemplo n.º 5
0
        public void ShouldWriteCacheElement()
        {
            var mapping = CollectionMapping.Array();

            mapping.Set(x => x.Cache, Layer.Defaults, new CacheMapping());

            writer.VerifyXml(mapping)
            .Element("cache").Exists();
        }
Ejemplo n.º 6
0
        public void ShouldWriteRelationshipElement()
        {
            var mapping = CollectionMapping.Array();

            mapping.Set(x => x.Relationship, Layer.Defaults, new OneToManyMapping());

            writer.VerifyXml(mapping)
            .Element("one-to-many").Exists();
        }
Ejemplo n.º 7
0
        public void ShouldWriteKey()
        {
            var mapping = CollectionMapping.Array();

            mapping.Set(x => x.Key, Layer.Defaults, new KeyMapping());

            writer.VerifyXml(mapping)
            .Element("key").Exists();
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Use an array
 /// </summary>
 /// <typeparam name="TIndex">Index type</typeparam>
 /// <param name="indexSelector">Index property</param>
 /// <param name="customIndexMapping">Index mapping</param>
 public T AsArray <TIndex>(Expression <Func <TChild, TIndex> > indexSelector, Action <IndexPart> customIndexMapping)
 {
     collectionBuilder = attrs => CollectionMapping.Array(attrs);
     return(AsIndexedCollection(indexSelector, customIndexMapping));
 }