public void Should_pass_the_discriminator_to_the_visitor()
        {
            var classMap = new ClassMapping {Name = "class1" };
            classMap.Discriminator = new DiscriminatorMapping();

            var visitor = MockRepository.GenerateMock<IMappingModelVisitor>();
            visitor.Expect(x => x.Visit(classMap.Discriminator));

            classMap.AcceptVisitor(visitor);

            visitor.VerifyAllExpectations();
        }
        public void Should_not_pass_null_id_to_the_visitor()
        {
            var classMap = new ClassMapping {Name = "class1" };
            classMap.Id = null;

            var visitor = MockRepository.GenerateMock<IMappingModelVisitor>();
            visitor.Expect(x => x.Visit(classMap.Id)).Repeat.Never();

            classMap.AcceptVisitor(visitor);

            visitor.VerifyAllExpectations();
        }
        public void Should_pass_subclasses_to_the_visitor()
        {
            var classMap = new ClassMapping {Name = "class1" };
            classMap.AddSubclass(new JoinedSubclassMapping());

            var visitor = MockRepository.GenerateMock<IMappingModelVisitor>();
            visitor.Expect(x => x.Visit(classMap.Subclasses.First()));

            classMap.AcceptVisitor(visitor);

            visitor.VerifyAllExpectations();
        }
 public override void Visit(ClassMapping classMapping)
 {
     classMapping.AcceptVisitor(this);
 }