public void WhenNoRegisterExclusionPropertyForInterfaceThenShouldWorkNormally()
        {
            var orm = new ObjectRelationalMapper();
            orm.TablePerClass<Person>();

            orm.IsPersistentProperty(ForClass<Person>.Property(p => p.Something)).Should().Be.True();
            orm.IsPersistentProperty(ForClass<Person>.Property(p => p.IsValid)).Should().Be.False();
            orm.IsPersistentProperty(ForClass<Person>.Property(p => p.Name)).Should().Be.True();
        }
        public void WhenNoRegisterExclusionPropertyForInterfaceThenShouldWorkNormally()
        {
            var orm = new ObjectRelationalMapper();

            orm.TablePerClass <Person>();

            orm.IsPersistentProperty(ForClass <Person> .Property(p => p.Something)).Should().Be.True();
            orm.IsPersistentProperty(ForClass <Person> .Property(p => p.IsValid)).Should().Be.False();
            orm.IsPersistentProperty(ForClass <Person> .Property(p => p.Name)).Should().Be.True();
        }
Пример #3
0
        public void WhenExplicitDeclaredExclusionThenNoPersistent()
        {
            var orm = new ObjectRelationalMapper();

            orm.ExcludeProperty <MyEntity>(me => me.NoReadOnly);
            orm.IsPersistentProperty(typeof(MyEntity).GetProperty("NoReadOnly")).Should().Be.False();
        }
Пример #4
0
        public void WhenExplicitDeclaredPersistentThenPersistent()
        {
            var orm = new ObjectRelationalMapper();

            orm.PersistentProperty <MyEntity>(me => me.ReadOnly);
            orm.IsPersistentProperty(typeof(MyEntity).GetProperty("ReadOnly")).Should().Be.True();
        }
        public void WhenRegisterPersistentPropertyOnInterfaceThenShouldRecognizePropertyOfConcreteImpl()
        {
            var orm = new ObjectRelationalMapper();
            orm.TablePerClass<Person>();
            orm.PersistentProperty<IEntity>(p => p.IsValid);

            orm.IsPersistentProperty(ForClass<Person>.Property(p => p.IsValid)).Should().Be.True();
        }
        public void WhenRegisterExclusionPropertyOnInterfaceThenShouldExcludePropertyOfConcreteImpl()
        {
            var orm = new ObjectRelationalMapper();
            orm.TablePerClass<Person>();
            orm.ExcludeProperty<IEntity>(p => p.Something);

            orm.IsPersistentProperty(ForClass<Person>.Property(p => p.Something)).Should().Be.False();
        }
        public void WhenRegisterExclusionPropertyOnInterfaceThenShouldExcludePropertyOfConcreteImpl()
        {
            var orm = new ObjectRelationalMapper();

            orm.TablePerClass <Person>();
            orm.ExcludeProperty <IEntity>(p => p.Something);

            orm.IsPersistentProperty(ForClass <Person> .Property(p => p.Something)).Should().Be.False();
        }
        public void WhenRegisterPersistentPropertyOnInterfaceThenShouldRecognizePropertyOfConcreteImpl()
        {
            var orm = new ObjectRelationalMapper();

            orm.TablePerClass <Person>();
            orm.PersistentProperty <IEntity>(p => p.IsValid);

            orm.IsPersistentProperty(ForClass <Person> .Property(p => p.IsValid)).Should().Be.True();
        }
        public void WhenBasePrivateSetPropertiesThenIsPersistent()
        {
            var orm = new ObjectRelationalMapper();

            orm.TablePerClass <Inerited>();
            PropertyInfo collectionProp = typeof(Inerited).GetProperty("PrivateCollection",
                                                                       BindingFlags.Public | BindingFlags.Instance
                                                                       | BindingFlags.FlattenHierarchy);

            orm.IsPersistentProperty(collectionProp).Should().Be.True();
        }
 public void AskForPersistentPropertyShouldUsePersistentPropertiesExclusionsPattern()
 {
     // This test look like an example and a test related to the predicate passed to orm.ExcludeProperty ; btw match the scope.
     var orm = new ObjectRelationalMapper();
     orm.ExcludeProperty(mi => mi.DeclaringType != typeof(Person) && typeof(Person).IsAssignableFrom(mi.DeclaringType));
     orm.IsPersistentProperty(ForClass<Person>.Property(x => x.Id)).Should().Be.True();
     orm.IsPersistentProperty(ForClass<Person>.Property(x => x.Name)).Should().Be.True();
     orm.IsPersistentProperty(ForClass<Student>.Property(x => x.Grade)).Should().Be.False();
     orm.IsPersistentProperty(ForClass<Student>.Property(x => x.Class)).Should().Be.False();
     orm.IsPersistentProperty(ForClass<Clerk>.Property(x => x.Company)).Should().Be.False();
     orm.IsPersistentProperty(ForClass<OutSideHierarchy>.Property(x => x.Id)).Should().Be.True();
     orm.IsPersistentProperty(ForClass<OutSideHierarchy>.Property(x => x.Name)).Should().Be.True();
 }
Пример #11
0
        public void AskForPersistentPropertyShouldUsePersistentPropertiesExclusionsPattern()
        {
            // This test look like an example and a test related to the predicate passed to orm.ExcludeProperty ; btw match the scope.
            var orm = new ObjectRelationalMapper();

            orm.ExcludeProperty(mi => mi.DeclaringType != typeof(Person) && typeof(Person).IsAssignableFrom(mi.DeclaringType));
            orm.IsPersistentProperty(ForClass <Person> .Property(x => x.Id)).Should().Be.True();
            orm.IsPersistentProperty(ForClass <Person> .Property(x => x.Name)).Should().Be.True();
            orm.IsPersistentProperty(ForClass <Student> .Property(x => x.Grade)).Should().Be.False();
            orm.IsPersistentProperty(ForClass <Student> .Property(x => x.Class)).Should().Be.False();
            orm.IsPersistentProperty(ForClass <Clerk> .Property(x => x.Company)).Should().Be.False();
            orm.IsPersistentProperty(ForClass <OutSideHierarchy> .Property(x => x.Id)).Should().Be.True();
            orm.IsPersistentProperty(ForClass <OutSideHierarchy> .Property(x => x.Name)).Should().Be.True();
        }
Пример #12
0
        public void RecognizePoidAsPersistentProperty()
        {
            PropertyInfo pi = typeof(TestEntity).GetProperty("Id");

            mapper.IsPersistentProperty(pi).Should().Be.True();
        }
 public void WhenReadOnlyPropThenNoPersistent()
 {
     var orm = new ObjectRelationalMapper();
     orm.IsPersistentProperty(typeof (MyEntity).GetProperty("ReadOnly")).Should().Be.False();
 }
 public void WhenExplicitDeclaredPersistentThenPersistent()
 {
     var orm = new ObjectRelationalMapper();
     orm.PersistentProperty<MyEntity>(me => me.ReadOnly);
     orm.IsPersistentProperty(typeof(MyEntity).GetProperty("ReadOnly")).Should().Be.True();
 }
 public void WhenExplicitDeclaredExclusionThenNoPersistent()
 {
     var orm = new ObjectRelationalMapper();
     orm.ExcludeProperty<MyEntity>(me => me.NoReadOnly);
     orm.IsPersistentProperty(typeof(MyEntity).GetProperty("NoReadOnly")).Should().Be.False();
 }
Пример #16
0
        public void WhenReadOnlyPropThenNoPersistent()
        {
            var orm = new ObjectRelationalMapper();

            orm.IsPersistentProperty(typeof(MyEntity).GetProperty("ReadOnly")).Should().Be.False();
        }