public void Should_apply_to_joined_subclass_mapping()
        {
            var joinedSubclassMapping = new JoinedSubclassMapping();
            joinedSubclassMapping.Type = typeof(Album);
            _namingConvention.ProcessJoinedSubclass(joinedSubclassMapping);

            joinedSubclassMapping.Name.ShouldEqual(joinedSubclassMapping.Type.AssemblyQualifiedName);
        }
        public void Should_produce_valid_hbm()
        {
            var joinedSubclassMapping = new JoinedSubclassMapping { Name = "joinedsubclass1", Key = new KeyMapping() };

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

            _subclassWriter.ShouldGenerateValidOutput(joinedSubclassMapping);
        }
        public void Should_write_the_collections()
        {
            var joinedSubclassMapping = new JoinedSubclassMapping();
            joinedSubclassMapping.AddCollection(new BagMapping());

            _mocker.Get<IHbmWriter<ICollectionMapping>>()
                .Expect(x => x.Write(joinedSubclassMapping.Collections.First())).Return(new HbmBag());

            _subclassWriter.VerifyXml(joinedSubclassMapping)
                .Element("bag").Exists();
        }
        public void Should_write_multiple_nestings_of_subclasses()
        {
            var joinedSubclassMapping = new JoinedSubclassMapping();

            joinedSubclassMapping.AddSubclass(new JoinedSubclassMapping { Name = "Child" });
            joinedSubclassMapping.Subclasses.First().AddSubclass(new JoinedSubclassMapping { Name = "Grandchild" });

            _subclassWriter.VerifyXml(joinedSubclassMapping)
                .Element("joined-subclass").Exists().HasAttribute("name", "Child")
                .Element("joined-subclass").Exists().HasAttribute("name", "Grandchild");
        }
 public void Can_add_subclass()
 {
     var joinedSubclass = new JoinedSubclassMapping();
     _classMapping.AddSubclass(joinedSubclass);
     _classMapping.Subclasses.ShouldContain(joinedSubclass);
 }
        public void Should_write_the_key()
        {
            var joinedSubclassMapping = new JoinedSubclassMapping { Key = new KeyMapping() };

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

            _subclassWriter.VerifyXml(joinedSubclassMapping)
                .Element("key").Exists();
        }
        public void Should_write_the_components()
        {
            var classMapping = new JoinedSubclassMapping();
            classMapping.AddComponent(new ComponentMapping());

            _mocker.Get<IHbmWriter<ComponentMapping>>()
                .Expect(x => x.Write(classMapping.Components.First())).Return(new HbmComponent());

            _subclassWriter.VerifyXml(classMapping)
                .Element("component").Exists();
        }
        public void Should_write_the_subclasses()
        {
            var joinedSubclassMapping = new JoinedSubclassMapping();
            joinedSubclassMapping.AddSubclass(new JoinedSubclassMapping());

            _subclassWriter.VerifyXml(joinedSubclassMapping)
                .Element("joined-subclass").Exists();
        }
        public void Should_write_the_references()
        {
            var joinedSubclassMapping = new JoinedSubclassMapping();
            joinedSubclassMapping.AddReference(new ManyToOneMapping());

            _mocker.Get<IHbmWriter<ManyToOneMapping>>()
                .Expect(x => x.Write(joinedSubclassMapping.References.First())).Return(new HbmManyToOne());

            _subclassWriter.VerifyXml(joinedSubclassMapping)
                .Element("many-to-one").Exists();
        }
        public void Should_write_the_properties()
        {
            var joinedSubclassMapping = new JoinedSubclassMapping();
            joinedSubclassMapping.AddProperty(new PropertyMapping());

            _mocker.Get<IHbmWriter<PropertyMapping>>()
                .Expect(x => x.Write(joinedSubclassMapping.Properties.First())).Return(new HbmProperty());

            _subclassWriter.VerifyXml(joinedSubclassMapping)
                .Element("property").Exists();
        }
 public void AddSubclass(JoinedSubclassMapping joinedSubclassMapping)
 {
     _subclasses.Add(joinedSubclassMapping);
 }
 public virtual void ProcessJoinedSubclass(JoinedSubclassMapping subclassMapping)
 {
 }
 public virtual void Visit(JoinedSubclassMapping subclassMapping)
 {
 }
 public override void ProcessJoinedSubclass(JoinedSubclassMapping subclassMapping)
 {
     ProcessClassBase(subclassMapping);
 }
 public override void Visit(JoinedSubclassMapping subclassMapping)
 {
     subclassMapping.AcceptVisitor(this);
 }