Inheritance: CollectionMappingBase
Exemplo n.º 1
0
 public ListInspector(ListMapping mapping)
     : base(mapping)
 {
     this.mapping = mapping;
     mappedProperties.AutoMap();
     mappedProperties.Map(x => x.LazyLoad, x => x.Lazy);
 }
        public void ShouldWriteListForListMapping()
        {
            var mapping = new ListMapping();

            writer.VerifyXml(mapping)
                .RootElement.HasName("list");
        }
        public void ShouldWriteCacheElement()
        {
            var mapping = new ListMapping();

            mapping.Cache = new CacheMapping();

            writer.VerifyXml(mapping)
                .Element("cache").Exists();
        }
        public void Should_write_the_index()
        {
            var list = new ListMapping {Index = new IndexMapping()};

            _mocker.Get<IXmlWriter<IndexMapping>>()
                .Expect(x => x.Write(list.Index))
                .Return(new HbmIndex());

            _listWriter.VerifyXml(list)
                .Element("index").Exists();
        }
        public void Should_write_the_contents()
        {
            var list = new ListMapping { Contents = new OneToManyMapping() };

            _mocker.Get<IXmlWriter<ICollectionContentsMapping>>()
                .Expect(x => x.Write(list.Contents))
                .Return(new HbmOneToMany());

            _listWriter.VerifyXml(list)
                .Element("one-to-many").Exists();
        }
        public void Should_produce_valid_hbm()
        {
            var list = new ListMapping { Name = "list1", Key = new KeyMapping(), Index = new IndexMapping(), Contents = new OneToManyMapping()};

            _mocker.Get<IXmlWriter<ICollectionContentsMapping>>()
                .Expect(x => x.Write(list.Contents)).Return(new HbmOneToMany { @class = "class1" });

            _mocker.Get<IXmlWriter<KeyMapping>>()
                .Expect(x => x.Write(list.Key)).Return(new HbmKey());

            _mocker.Get<IXmlWriter<IndexMapping>>()
               .Expect(x => x.Write(list.Index)).Return(new HbmIndex());

            _listWriter.ShouldGenerateValidOutput(list);
        }
 public void CreateDsl()
 {
     mapping = new ListMapping();
     inspector = new ListInspector(mapping);
 }
 public override void ProcessList(ListMapping listMapping)
 {
     ProcessCollection(listMapping);
 }
        public void ShouldWriteElement()
        {
            var mapping = new ListMapping();

            mapping.Element = new ElementMapping();

            writer.VerifyXml(mapping)
                .Element("element").Exists();
        }
        public void ShouldWriteKey()
        {
            var mapping = new ListMapping
            {
                Key = new KeyMapping()
            };

            writer.VerifyXml(mapping)
                .Element("key").Exists();
        }
        public void ShouldWriteIndexElement()
        {
            var mapping = new ListMapping();

            mapping.Index = new IndexMapping();

            writer.VerifyXml(mapping)
                .Element("index").Exists();
        }
 public void ShouldNotWriteCollectionTypeWhenEmpty()
 {
     var bagMapping = new ListMapping { CollectionType = TypeReference.Empty };
     writer.VerifyXml(bagMapping)
         .DoesntHaveAttribute("collection-type");
 }
 public void MutableShouldBeTrueByDefaultOnListMapping()
 {
     var mapping = new ListMapping();
     mapping.Mutable.ShouldBeTrue();
 }
        public void Should_write_the_key()
        {
            var list = new ListMapping { Key = new KeyMapping() };

            _mocker.Get<IXmlWriter<KeyMapping>>()
                .Expect(x => x.Write(list.Key))
                .Return(new HbmKey());

            _listWriter.VerifyXml(list)
                .Element("key").Exists();
        }
Exemplo n.º 15
0
 public ListInstance(ListMapping mapping)
     : base(mapping)
 {
     this.mapping = mapping;
 }
 public virtual void ProcessList(ListMapping listMapping)
 {
 }
        public void ShouldWriteRelationshipElement()
        {
            var mapping = new ListMapping();

            mapping.Relationship = new OneToManyMapping();

            writer.VerifyXml(mapping)
                .Element("one-to-many").Exists();
        }