public void WhenSubjectIsNullThenNotThrow() { var orm = new ObjectRelationalMapper(); var pattern = new PolymorphismBidirectionalAnyToManyPattern(orm); pattern.Executing(p => p.Match(null)).NotThrows(); }
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 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 OneToManyKeyColumnApplier(IDomainInspector domainInspector) : base(domainInspector) { polymorphismBidirectionalAnyToManyPattern = new PolymorphismBidirectionalAnyToManyPattern(domainInspector); }