public void WhenTheDomainContainsMoreImplsThenMatch() { var orm = new ObjectRelationalMapper(); orm.TablePerClass <MyEntity>(); orm.TablePerClass <MyRoot1>(); orm.TablePerClass <MyRelatedRoot2>(); orm.AddToDomain(typeof(MyRelatedNoRoot1)); var pattern = new PolymorphismBidirectionalAnyToManyPattern(orm); pattern.Match(ForClass <MyRelatedNoRoot1> .Property(x => x.Items)).Should().Be.True(); pattern.Match(ForClass <MyRelatedRoot2> .Property(x => x.Items)).Should().Be.True(); }
public void WhenTheDomainDoesNotContainMoreImplsThenNoMatch() { var orm = new ObjectRelationalMapper(); orm.TablePerClass <MyEntity>(); orm.TablePerClass <MyRelatedRoot1>(); var pattern = new PolymorphismBidirectionalAnyToManyPattern(orm); pattern.Match(ForClass <MyRelatedRoot1> .Property(x => x.Items)).Should().Be.False(); }
public void WhenManySideIsNotAnEntityThenNoMatch() { var orm = new ObjectRelationalMapper(); orm.TablePerClass <MyRelatedRoot1>(); orm.TablePerClass <MyRelatedRoot2>(); var pattern = new PolymorphismBidirectionalAnyToManyPattern(orm); pattern.Match(ForClass <MyRelatedRoot1> .Property(x => x.Items)).Should().Be.False(); }
public virtual bool Match(PropertyPath subject) { var property = subject.LocalMember; return(Match(property) && !polymorphismBidirectionalAnyToManyPattern.Match(property)); }