public void CanAddClassMappings() { var hibMap = new HibernateMapping(); var classMap1 = new ClassMapping(); var classMap2 = new ClassMapping(); hibMap.AddClass(classMap1); hibMap.AddClass(classMap2); hibMap.Classes.ShouldContain(classMap1); hibMap.Classes.ShouldContain(classMap2); }
public static XmlDocument ToXml(this ClassMapping mapping) { var hbm = new HibernateMapping(); hbm.AddClass(mapping); return(new MappingXmlSerializer() .Serialize(hbm)); }
public void ShouldOnlyOutputOneClass() { var mapping = new HibernateMapping(); mapping.AddClass(new ClassMapping()); writer.VerifyXml(mapping) .Element("class[2]").DoesntExist(); }
public void ShouldWriteClasses() { var mapping = new HibernateMapping(); mapping.AddClass(new ClassMapping()); writer.VerifyXml(mapping) .Element("class").Exists(); }
public void ShouldPassClassmappingsToTheVisitor() { var hibMap = new HibernateMapping(); var classMap = new ClassMapping(); hibMap.AddClass(classMap); var visitor = MockRepository.GenerateMock <IMappingModelVisitor>(); visitor.Expect(x => x.Visit(classMap)); hibMap.AcceptVisitor(visitor); visitor.VerifyAllExpectations(); }
private void BuildSingleMapping(Action <HibernateMapping> add) { var hbm = new HibernateMapping(); foreach (var classMap in classProviders) { hbm.AddClass(classMap.GetClassMapping()); } foreach (var filterDefinition in filterDefinitions) { hbm.AddFilter(filterDefinition.GetFilterMapping()); } if (hbm.Classes.Any()) { add(hbm); } }
public void ShouldPassClassmappingsToTheVisitor() { // FakeItEasy calls ToString methods, which ends up in NullPointer // if Type attribute is not the AttributeStore var attributeStore = new AttributeStore(); attributeStore.Set("Type", 0, typeof(object)); var hibMap = new HibernateMapping(); var classMap = new ClassMapping(attributeStore); hibMap.AddClass(classMap); var visitor = A.Fake <IMappingModelVisitor>(); hibMap.AcceptVisitor(visitor); A.CallTo(() => visitor.Visit(classMap)).MustHaveHappened(); }