public void MappedShouldDefaultToFalseIfNameAttributeIsBlank()
        {
            var store = new AttributeStore<CompositeIdMapping>();
            store.Set(x => x.Name, string.Empty);

            var mapping = new CompositeIdMapping(store.CloneInner());
            mapping.Mapped.ShouldBeFalse();
        }
        public void MappedShouldDefaultToTrueIfNameAttributeIsSet()
        {
            var store = new AttributeStore<CompositeIdMapping>();
            store.Set(x => x.Name, "someName");

            var mapping = new CompositeIdMapping(store.CloneInner());
            mapping.Mapped.ShouldBeTrue();
        }
        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();
        }
 protected override void Set(string attribute, int layer, object value)
 {
     attributes.Set(attribute, layer, value);
 }
Exemplo n.º 5
0
 public void Set(string attribute, int layer, object value)
 {
     attributes.Set(attribute, layer, value);
 }
        public void Should_pass_subclasses_to_the_visitor()
        {
            // FakeItEasy ;for some reason; calls ToString method on SubClassMapping
            // which ended in NullPointerException if AttributeStore didn't contain Type attribute.
            var attributeStore = new AttributeStore();
            attributeStore.Set("Type", 0, typeof(object));

            var classMap = new ClassMapping();
            classMap.Set(x => x.Name, Layer.Defaults, "class1");
            classMap.AddSubclass(new SubclassMapping(SubclassType.JoinedSubclass, attributeStore));

            var visitor = A.Fake<IMappingModelVisitor>();

            classMap.AcceptVisitor(visitor);

            A.CallTo(() => visitor.Visit(classMap.Subclasses.First())).MustHaveHappened();
        }