public void ShouldWriteProperties() { var mapping = new CompositeElementMapping(); mapping.AddProperty(new PropertyMapping()); writer.VerifyXml(mapping) .Element("property").Exists(); }
public void ShouldWriteProperties() { var mapping = new CompositeElementMapping(); mapping.AddProperty(new PropertyMapping()); writer.VerifyXml(mapping) .Element("property").Exists(); }
public void ShouldWriteParentAsFirstElement() { var mapping = new CompositeElementMapping(); mapping.Parent = new ParentMapping(); mapping.AddProperty(new PropertyMapping()); writer.VerifyXml(mapping) .Element("parent").IsFirst() .Element("property").Exists(); }
public void ShouldWriteParentAsFirstElement() { var mapping = new CompositeElementMapping(); mapping.Parent = new ParentMapping(); mapping.AddProperty(new PropertyMapping()); writer.VerifyXml(mapping) .Element("parent").IsFirst() .Element("property").Exists(); }
protected virtual PropertyBuilder Map(Member property, string columnName) { var propertyMapping = new PropertyMapping(); var builder = new PropertyBuilder(propertyMapping, typeof(T), property); if (!string.IsNullOrEmpty(columnName)) { builder.Column(columnName); } mapping.AddProperty(propertyMapping); return(builder); }
public void ShouldWriteTheProperties() { var compositeElementMapping = new CompositeElementMapping(); compositeElementMapping.AddProperty(new PropertyMapping()); var propertyDocument = new XmlDocument(); propertyDocument.AppendChild(propertyDocument.CreateElement("property")); var propertyWriter = MockRepository.GenerateMock<IXmlWriter<PropertyMapping>>(); propertyWriter .Expect(x => x.Write(compositeElementMapping.Properties.First())) .Return(propertyDocument); xmlCompositeElementWriter = new XmlCompositeElementWriter(propertyWriter); xmlCompositeElementWriter.VerifyXml(compositeElementMapping) .Element("property").Exists(); }
void PopulateMapping(CompositeElementMapping mapping) { mapping.ContainingEntityType = entity; mapping.Set(x => x.Class, Layer.Defaults, new TypeReference(typeof(T))); foreach (var property in properties) { mapping.AddProperty(property.GetPropertyMapping()); } foreach (var reference in references) { mapping.AddReference(reference.GetManyToOneMapping()); } foreach (var component in components) { mapping.AddCompositeElement(component.GetCompositeElementMapping()); } }
CompositeElementMapping ICompositeElementMappingProvider.GetCompositeElementMapping() { var mapping = new CompositeElementMapping(attributes.CloneInner()); mapping.ContainingEntityType = entity; if (!mapping.IsSpecified("Class")) { mapping.Class = new TypeReference(typeof(T)); } foreach (var property in properties) { mapping.AddProperty(property.GetPropertyMapping()); } foreach (var reference in references) { mapping.AddReference(reference.GetManyToOneMapping()); } return(mapping); }
void PopulateMapping(CompositeElementMapping mapping) { mapping.ContainingEntityType = entity; if (!mapping.IsSpecified("Class")) { mapping.Class = new TypeReference(typeof(T)); } foreach (var property in properties) { mapping.AddProperty(property.GetPropertyMapping()); } foreach (var reference in references) { mapping.AddReference(reference.GetManyToOneMapping()); } foreach (var component in components) { mapping.AddCompositeElement(component.GetCompositeElementMapping()); } }
public void PropertiesCollectionHasSameCountAsMapping() { mapping.AddProperty(new PropertyMapping()); inspector.Properties.Count().ShouldEqual(1); }