public void WhenExplicitRegisteredRecognizeMaster()
 {
     var mapper = new ObjectRelationalMapper();
     mapper.TablePerClass<User>();
     mapper.TablePerClass<Person>();
     mapper.OneToOne<User, Person>();
     mapper.IsMasterOneToOne(typeof(User), typeof(Person)).Should().Be.True();
 }
        public void WhenExplicitRegisteredRecognizeInverseRelationAsImplicit()
        {
            var mapper = new ObjectRelationalMapper();

            mapper.TablePerClass <User>();
            mapper.TablePerClass <Person>();
            mapper.OneToOne <User, Person>();
            mapper.IsMasterOneToOne(typeof(Person), typeof(User)).Should().Be.False();
        }
        public void WhenUnidirectionalOneToOneThenShouldBeManyToOne()
        {
            var orm = new ObjectRelationalMapper();
            orm.TablePerClass(new[] {typeof (MyClass), typeof (MyOneClass)});
            orm.OneToOne<MyClass, MyOneClass>();

            orm.IsOneToOne(typeof (MyClass), typeof (MyOneClass)).Should().Be.False();
            orm.IsManyToOne(typeof(MyClass), typeof(MyOneClass)).Should().Be.True();
            orm.IsMasterOneToOne(typeof(MyClass), typeof(MyOneClass)).Should().Be.True();
        }
Beispiel #4
0
        public void WhenUnidirectionalOneToOneThenShouldBeManyToOne()
        {
            var orm = new ObjectRelationalMapper();

            orm.TablePerClass(new[] { typeof(MyClass), typeof(MyOneClass) });
            orm.OneToOne <MyClass, MyOneClass>();

            orm.IsOneToOne(typeof(MyClass), typeof(MyOneClass)).Should().Be.False();
            orm.IsManyToOne(typeof(MyClass), typeof(MyOneClass)).Should().Be.True();
            orm.IsMasterOneToOne(typeof(MyClass), typeof(MyOneClass)).Should().Be.True();
        }