Inheritance: CollectionMappingBase
 public SetInspector(SetMapping mapping)
     : base(mapping)
 {
     this.mapping = mapping;
     mappedProperties.AutoMap();
     mappedProperties.Map(x => x.LazyLoad, x => x.Lazy);
 }
        public void ShouldWriteSetForSetMapping()
        {
            var mapping = new SetMapping();

            writer.VerifyXml(mapping)
                .RootElement.HasName("set");
        }
        public void Should_not_write_the_default_access_type()
        {
            var set = new SetMapping();

            _writer.VerifyXml(set)
                .DoesntHaveAttribute("access");
        }
        public void Should_write_the_specified_access_type()
        {
            var set = new SetMapping();
            set.MemberAccess = MemberAccess.Create(AccessStrategy.Field, NamingStrategy.CamelCase);

            _writer.VerifyXml(set)
                .HasAttribute("access", "field.camelcase");
        }
        public void ShouldWriteCacheElement()
        {
            var mapping = new SetMapping();

            mapping.Cache = new CacheMapping();

            writer.VerifyXml(mapping)
                .Element("cache").Exists();
        }
        public void Should_produce_valid_hbm()
        {
            var set = new SetMapping { Name = "set1", Contents = new OneToManyMapping(), Key = new KeyMapping() };

            _mocker.Get<IHbmWriter<ICollectionContentsMapping>>()
                .Expect(x => x.Write(set.Contents)).Return(new HbmOneToMany { @class = "class1" });
            _mocker.Get<IHbmWriter<KeyMapping>>()
                .Expect(x => x.Write(set.Key)).Return(new HbmKey());

            _writer.ShouldGenerateValidOutput(set);
        }
Example #7
0
 public bool Equals(SetMapping other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(base.Equals(other) && Equals(other.attributes, attributes));
 }
        public void Should_produce_valid_hbm()
        {
            var set = new SetMapping { Name = "set1", Contents = new OneToManyMapping(), Key = new KeyMapping() };

            var contentsWriter = MockRepository.GenerateStub<IXmlWriter<ICollectionContentsMapping>>();
            contentsWriter.Expect(x => x.Write(set.Contents)).Return(new HbmOneToMany { @class = "class1" });
            var keyWriter = MockRepository.GenerateStub<IXmlWriter<KeyMapping>>();
            keyWriter.Expect(x => x.Write(set.Key)).Return(new HbmKey());

            var writer = new HbmSetWriter(contentsWriter, keyWriter);

            writer.ShouldGenerateValidOutput(set);
        }
Example #9
0
 public SetInstance(SetMapping mapping)
     : base(mapping)
 {
     this.mapping = mapping;
 }
 public override void ProcessSet(SetMapping setMapping)
 {
     ProcessCollection(setMapping);
 }
        public void ShouldWriteElement()
        {
            var mapping = new SetMapping();

            mapping.Element = new ElementMapping();

            writer.VerifyXml(mapping)
                .Element("element").Exists();
        }
        public void ShouldWriteRelationshipElement()
        {
            var mapping = new SetMapping();

            mapping.Relationship = new OneToManyMapping();

            writer.VerifyXml(mapping)
                .Element("one-to-many").Exists();
        }
 public void CreateDsl()
 {
     mapping = new SetMapping();
     inspector = new SetInspector(mapping);
 }
 public void ShouldNotWriteCollectionTypeWhenEmpty()
 {
     var bagMapping = new SetMapping { CollectionType = TypeReference.Empty };
     writer.VerifyXml(bagMapping)
         .DoesntHaveAttribute("collection-type");
 }
 public void MutableShouldBeTrueByDefaultOnSetMapping()
 {
     var mapping = new SetMapping();
     mapping.Mutable.ShouldBeTrue();
 }
 public virtual void ProcessSet(SetMapping setMapping)
 {
 }
        public void ShouldWriteKey()
        {
            var mapping = new SetMapping
            {
                Key = new KeyMapping()
            };

            writer.VerifyXml(mapping)
                .Element("key").Exists();
        }