public void Should_write_the_key()
        {
            var bag = new BagMapping { Key = new KeyMapping()};

            var keyWriter = MockRepository.GenerateMock<IXmlWriter<KeyMapping>>();
            keyWriter.Expect(x => x.Write(bag.Key))
                .Return(new HbmKey());

            var writer = new HbmBagWriter(null, keyWriter);

            writer.VerifyXml(bag)
                .Element("key").Exists();
        }
        public void Should_write_the_contents()
        {
            var bag = new BagMapping {Contents = new OneToManyMapping()};

            var contentsWriter = MockRepository.GenerateMock<IXmlWriter<ICollectionContentsMapping>>();
            contentsWriter.Expect(x => x.Write(bag.Contents))
                .Return(new HbmOneToMany());

            var writer = new HbmBagWriter(contentsWriter, null);

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