public void WhenNoCircularThenOneToManyMatch() { var orm = new Mock <IDomainInspector>(); var pattern = new BidirectionalOneToManyCascadeApplier(orm.Object); pattern.Match(ForClass <Parent> .Property(p => p.Children)).Should().Be.True(); }
public void WhenNoCircularThenManyToOneNoMatch() { var orm = new Mock <IDomainInspector>(); var pattern = new BidirectionalOneToManyCascadeApplier(orm.Object); pattern.Match(ForClass <Child> .Property(c => c.Parent)).Should().Be.False(); }
public void WhenCircularThenOneToManyMatch() { var orm = new Mock <IDomainInspector>(); var pattern = new BidirectionalOneToManyCascadeApplier(orm.Object); pattern.Match(subnodesProperty).Should().Be.True(); }
public void WhenCircularThenManyToOneNoMatch() { var orm = new Mock <IDomainInspector>(); var pattern = new BidirectionalOneToManyCascadeApplier(orm.Object); pattern.Match(parentProperty).Should().Be.False(); }
public void ApplyAlwaysReturnCascade() { var orm = new Mock <IDomainInspector>(); var pattern = new BidirectionalOneToManyCascadeApplier(orm.Object); var collectionMapping = new Mock <ICollectionPropertiesMapper>(); pattern.Apply(null, collectionMapping.Object); collectionMapping.Verify(cm => cm.Cascade(It.Is <Cascade>(cascade => cascade.Has(Cascade.All) && cascade.Has(Cascade.DeleteOrphans)))); }
public void WhenCircularThenOneToManyMatch() { var orm = new Mock <IDomainInspector>(); orm.Setup(x => x.IsPersistentProperty(It.IsAny <MemberInfo>())).Returns(true); var pattern = new BidirectionalOneToManyCascadeApplier(orm.Object); pattern.Match(subnodesProperty).Should().Be.True(); }
public void WhenNoCircularThenManyToOneNoMatch() { var orm = new Mock <IDomainInspector>(); orm.Setup(x => x.IsPersistentProperty(It.IsAny <MemberInfo>())).Returns(true); var pattern = new BidirectionalOneToManyCascadeApplier(orm.Object); pattern.Match(ConfOrm.ForClass <Child> .Property(c => c.Parent)).Should().Be.False(); }
public void ApplyAlwaysReturnCascade() { var orm = new Mock<IDomainInspector>(); var pattern = new BidirectionalOneToManyCascadeApplier(orm.Object); var collectionMapping = new Mock<ICollectionPropertiesMapper>(); pattern.Apply(null, collectionMapping.Object); collectionMapping.Verify(cm=> cm.Cascade(It.Is<Cascade>(cascade=> cascade.Has(Cascade.All) && cascade.Has(Cascade.DeleteOrphans)))); }
public void WhenNoCircularThenOneToManyMatch() { var orm = new Mock<IDomainInspector>(); var pattern = new BidirectionalOneToManyCascadeApplier(orm.Object); pattern.Match(ForClass<Parent>.Property(p=> p.Children)).Should().Be.True(); }
public void WhenNoCircularThenManyToOneNoMatch() { var orm = new Mock<IDomainInspector>(); var pattern = new BidirectionalOneToManyCascadeApplier(orm.Object); pattern.Match(ForClass<Child>.Property(c=> c.Parent)).Should().Be.False(); }
public void WhenCircularThenOneToManyMatch() { var orm = new Mock<IDomainInspector>(); var pattern = new BidirectionalOneToManyCascadeApplier(orm.Object); pattern.Match(subnodesProperty).Should().Be.True(); }
public void WhenCircularThenManyToOneNoMatch() { var orm = new Mock<IDomainInspector>(); var pattern = new BidirectionalOneToManyCascadeApplier(orm.Object); pattern.Match(parentProperty).Should().Be.False(); }