public void WhenDefineWithNullThenRegisterValid()
        {
            var orm = new ObjectRelationalMapper();
            orm.TablePerClass<MyClass>();
            orm.TablePerClass<Related>();
            orm.NaturalId<MyClass>(x => x.Name, null, x => x.MyComponent, null);

            orm.IsMemberOfNaturalId(ForClass<MyClass>.Property(x => x.Name)).Should().Be.True();
            orm.IsMemberOfNaturalId(ForClass<MyClass>.Property(x => x.Related)).Should().Be.False();
            orm.IsMemberOfNaturalId(ForClass<MyClass>.Property(x => x.MyComponent)).Should().Be.True();
            orm.IsMemberOfNaturalId(ForClass<MyClass>.Property(x => x.Any)).Should().Be.False();
        }
        public void WhenDefineRootEntityThenRegister()
        {
            var orm = new ObjectRelationalMapper();
            orm.TablePerClass<MyClass>();
            orm.TablePerClass<Related>();
            orm.NaturalId<MyClass>(x => x.Name, x => x.Related, x => x.MyComponent, x => x.Any);

            orm.IsMemberOfNaturalId(ForClass<MyClass>.Property(x => x.Name)).Should().Be.True();
            orm.IsMemberOfNaturalId(ForClass<MyClass>.Property(x => x.Related)).Should().Be.True();
            orm.IsMemberOfNaturalId(ForClass<MyClass>.Property(x => x.MyComponent)).Should().Be.True();
            orm.IsMemberOfNaturalId(ForClass<MyClass>.Property(x => x.Any)).Should().Be.True();
        }
예제 #3
0
        public void WhenDefineWithNullThenRegisterValid()
        {
            var orm = new ObjectRelationalMapper();

            orm.TablePerClass <MyClass>();
            orm.TablePerClass <Related>();
            orm.NaturalId <MyClass>(x => x.Name, null, x => x.MyComponent, null);

            orm.IsMemberOfNaturalId(ForClass <MyClass> .Property(x => x.Name)).Should().Be.True();
            orm.IsMemberOfNaturalId(ForClass <MyClass> .Property(x => x.Related)).Should().Be.False();
            orm.IsMemberOfNaturalId(ForClass <MyClass> .Property(x => x.MyComponent)).Should().Be.True();
            orm.IsMemberOfNaturalId(ForClass <MyClass> .Property(x => x.Any)).Should().Be.False();
        }
예제 #4
0
        public void WhenDefineRootEntityThenRegister()
        {
            var orm = new ObjectRelationalMapper();

            orm.TablePerClass <MyClass>();
            orm.TablePerClass <Related>();
            orm.NaturalId <MyClass>(x => x.Name, x => x.Related, x => x.MyComponent, x => x.Any);

            orm.IsMemberOfNaturalId(ForClass <MyClass> .Property(x => x.Name)).Should().Be.True();
            orm.IsMemberOfNaturalId(ForClass <MyClass> .Property(x => x.Related)).Should().Be.True();
            orm.IsMemberOfNaturalId(ForClass <MyClass> .Property(x => x.MyComponent)).Should().Be.True();
            orm.IsMemberOfNaturalId(ForClass <MyClass> .Property(x => x.Any)).Should().Be.True();
        }