public void WhenExplicitManyToManyThenShouldMapSimpleRelationAsManyToOneByDefault()
        {
            var orm = new ObjectRelationalMapper();
            orm.TablePerClass<User>();
            orm.TablePerClass<Group>();
            orm.ManyToMany<Group, User>();

            orm.IsManyToOne(typeof(Group), typeof(User)).Should().Be.True();
            orm.IsManyToMany(typeof(Group), typeof(User)).Should().Be.True();
            orm.IsOneToMany(typeof(Group), typeof(User)).Should().Be.False();
            orm.IsOneToOne(typeof(Group), typeof(User)).Should().Be.False();
            orm.IsManyToMany(typeof(User), typeof(Group)).Should().Be.True();
            orm.IsOneToMany(typeof(User), typeof(Group)).Should().Be.False();
        }
예제 #2
0
        public void WhenExplicitManyToManyThenShouldMapSimpleRelationAsManyToOneByDefault()
        {
            var orm = new ObjectRelationalMapper();

            orm.TablePerClass <User>();
            orm.TablePerClass <Group>();
            orm.ManyToMany <Group, User>();

            orm.IsManyToOne(typeof(Group), typeof(User)).Should().Be.True();
            orm.IsManyToMany(typeof(Group), typeof(User)).Should().Be.True();
            orm.IsOneToMany(typeof(Group), typeof(User)).Should().Be.False();
            orm.IsOneToOne(typeof(Group), typeof(User)).Should().Be.False();
            orm.IsManyToMany(typeof(User), typeof(Group)).Should().Be.True();
            orm.IsOneToMany(typeof(User), typeof(Group)).Should().Be.False();
        }
 public void WhenExplicitRegisteredRecognizeRelation()
 {
     var mapper = new ObjectRelationalMapper();
     mapper.TablePerClass<AEntity>();
     mapper.TablePerClass<BEntity>();
     mapper.ManyToMany<AEntity, BEntity>();
     mapper.IsManyToMany(typeof(AEntity), typeof(BEntity)).Should().Be.True();
 }
        public void WhenExplicitRegisteredRecognizeInverseRelation()
        {
            var mapper = new ObjectRelationalMapper();

            mapper.TablePerClass <AEntity>();
            mapper.TablePerClass <BEntity>();
            mapper.ManyToMany <AEntity, BEntity>();
            mapper.IsManyToMany(typeof(BEntity), typeof(AEntity)).Should().Be.True();
        }
        public void WhenFindInterfaceForRootClassInCollectionThenRecognizeRelation()
        {
            var orm = new ObjectRelationalMapper();
            orm.TablePerClass<Contact>();
            orm.TablePerClass<UserGroup>();
            orm.ManyToMany<UserGroup, ISecurity>();

            orm.IsManyToMany(typeof(ISecurity), typeof(UserGroup)).Should().Be.True();
        }
예제 #6
0
        public void WhenFindInterfaceForRootClassInCollectionThenRecognizeRelation()
        {
            var orm = new ObjectRelationalMapper();

            orm.TablePerClass <Contact>();
            orm.TablePerClass <UserGroup>();
            orm.ManyToMany <UserGroup, ISecurity>();

            orm.IsManyToMany(typeof(ISecurity), typeof(UserGroup)).Should().Be.True();
        }