Пример #1
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 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 WhenRegisterExclusionPropertyOnInterfaceAndInclusionOnConcreteThenShouldIncludePropertyOfConcreteImpl()
        {
            var orm = new ObjectRelationalMapper();
            orm.TablePerClass<Person>();
            orm.ExcludeProperty<IEntity>(p => p.Something);
            orm.PersistentProperty<Person>(p => p.Something);

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

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

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

            var mapper = new Mapper(orm);
            var mappings = mapper.CompileMappingFor(new[] { typeof(Person) });

            var hbmClass = mappings.RootClasses.Single();
            hbmClass.Properties.Select(p => p.Name).Should().Have.SameValuesAs("Something", "Name", "IsValid");
        }
        public void WhenRegisterPersistentPropertyOnImplicitEntityThenShouldMapEvenPersistentReadOnlyProperties()
        {
            var orm = new ObjectRelationalMapper();

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

            var mapper   = new Mapper(orm);
            var mappings = mapper.CompileMappingFor(new[] { typeof(Person) });

            var hbmClass = mappings.RootClasses.Single();

            hbmClass.Properties.Select(p => p.Name).Should().Have.SameValuesAs("Something", "Name", "IsValid");
        }
 public void WhenExplicitDeclaredPersistentThenPersistent()
 {
     var orm = new ObjectRelationalMapper();
     orm.PersistentProperty<MyEntity>(me => me.ReadOnly);
     orm.IsPersistentProperty(typeof(MyEntity).GetProperty("ReadOnly")).Should().Be.True();
 }