Inheritance: CollectionMappingBase
コード例 #1
0
 public SetInspector(SetMapping mapping)
     : base(mapping)
 {
     this.mapping = mapping;
     mappedProperties.AutoMap();
     mappedProperties.Map(x => x.LazyLoad, x => x.Lazy);
 }
コード例 #2
0
        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");
        }
コード例 #5
0
        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);
        }
コード例 #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));
 }
コード例 #8
0
        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);
        }
コード例 #9
0
 public SetInstance(SetMapping mapping)
     : base(mapping)
 {
     this.mapping = mapping;
 }
コード例 #10
0
 public override void ProcessSet(SetMapping setMapping)
 {
     ProcessCollection(setMapping);
 }
コード例 #11
0
        public void ShouldWriteElement()
        {
            var mapping = new SetMapping();

            mapping.Element = new ElementMapping();

            writer.VerifyXml(mapping)
                .Element("element").Exists();
        }
コード例 #12
0
        public void ShouldWriteRelationshipElement()
        {
            var mapping = new SetMapping();

            mapping.Relationship = new OneToManyMapping();

            writer.VerifyXml(mapping)
                .Element("one-to-many").Exists();
        }
コード例 #13
0
 public void CreateDsl()
 {
     mapping = new SetMapping();
     inspector = new SetInspector(mapping);
 }
コード例 #14
0
 public void ShouldNotWriteCollectionTypeWhenEmpty()
 {
     var bagMapping = new SetMapping { CollectionType = TypeReference.Empty };
     writer.VerifyXml(bagMapping)
         .DoesntHaveAttribute("collection-type");
 }
コード例 #15
0
 public void MutableShouldBeTrueByDefaultOnSetMapping()
 {
     var mapping = new SetMapping();
     mapping.Mutable.ShouldBeTrue();
 }
コード例 #16
0
 public virtual void ProcessSet(SetMapping setMapping)
 {
 }
コード例 #17
0
        public void ShouldWriteKey()
        {
            var mapping = new SetMapping
            {
                Key = new KeyMapping()
            };

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