public AddClass ( ClassMapping classMapping ) : void | ||
classMapping | ClassMapping | |
Résultat | void |
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 void ShouldOnlyOutputOneClass() { var mapping = new HibernateMapping(); mapping.AddClass(new ClassMapping()); writer.VerifyXml(mapping) .Element("class[2]").DoesntExist(); }
public void Should_append_class_mappings() { var hibernateMap = new HibernateMapping(); hibernateMap.AddClass(new ClassMapping { Name = "class1" }); var classWriter = MockRepository.GenerateStub<IXmlWriter<ClassMapping>>(); classWriter.Stub((x => x.Write(hibernateMap.Classes.First()))).Return(new HbmClass()); var writer = new HbmHibernateMappingWriter(classWriter); writer.VerifyXml(hibernateMap) .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(); }
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(); }
private void BuildSingleMapping(Action<HibernateMapping> add) { var hbm = new HibernateMapping(); foreach (var classMap in classProviders) { hbm.AddClass(classMap.GetClassMapping()); } if (hbm.Classes.Count() > 0) add(hbm); }
public HibernateMapping BuildHibernateMapping() { var rootMapping = new HibernateMapping(); rootMapping.DefaultLazy = false; foreach (var classMapping in _mappings) rootMapping.AddClass(classMapping); return rootMapping; }
public void ShouldWriteClasses() { var mapping = new HibernateMapping(); mapping.AddClass(new ClassMapping()); writer.VerifyXml(mapping) .Element("class").Exists(); }