public void ShouldWriteArrayForArrayMapping() { var mapping = CollectionMapping.Array(); writer.VerifyXml(mapping) .RootElement.HasName("array"); }
public void ShouldNotWriteCollectionTypeWhenEmpty() { var mapping = CollectionMapping.Array(); mapping.Set(x => x.CollectionType, Layer.Defaults, TypeReference.Empty); writer.VerifyXml(mapping) .DoesntHaveAttribute("collection-type"); }
public void ShouldWriteElement() { var mapping = CollectionMapping.Array(); mapping.Set(x => x.Element, Layer.Defaults, new ElementMapping()); writer.VerifyXml(mapping) .Element("element").Exists(); }
public void ShouldWriteIndexElement() { var mapping = CollectionMapping.Array(); mapping.Set(x => x.Index, Layer.Defaults, new IndexMapping()); writer.VerifyXml(mapping) .Element("index").Exists(); }
public void ShouldWriteCacheElement() { var mapping = CollectionMapping.Array(); mapping.Set(x => x.Cache, Layer.Defaults, new CacheMapping()); writer.VerifyXml(mapping) .Element("cache").Exists(); }
public void ShouldWriteRelationshipElement() { var mapping = CollectionMapping.Array(); mapping.Set(x => x.Relationship, Layer.Defaults, new OneToManyMapping()); writer.VerifyXml(mapping) .Element("one-to-many").Exists(); }
public void ShouldWriteKey() { var mapping = CollectionMapping.Array(); mapping.Set(x => x.Key, Layer.Defaults, new KeyMapping()); writer.VerifyXml(mapping) .Element("key").Exists(); }
/// <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)); }