public void WhenCollectionOfElementsThenNoMatch() { var orm = GetDomainInspectorMock(); var pattern = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object); var property = new PropertyPath(null, ForClass<MyClass>.Property(mc => mc.Elements)); pattern.Match(property).Should().Be.False(); }
public void WhenNoPropertyThenNoMatch() { var orm = new Mock <IDomainInspector>(); var pattern = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object); pattern.Match(null).Should().Be.False(); }
public void WhenSingleUsageThenNoMatch() { var orm = GetDomainInspectorMockForBaseTests(); var applier = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object); var property = new PropertyPath(null, ForClass<MySingleUsage>.Property(x => x.CurrentPositions)); applier.Match(property).Should().Be.False(); }
public void WhenCollectionOfElementsThenNoMatch() { var orm = GetDomainInspectorMock(); var pattern = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object); var property = new PropertyPath(null, ConfOrm.ForClass <MyClass> .Property(mc => mc.Elements)); pattern.Match(property).Should().Be.False(); }
public void WhenDictionaryBidirectionalThenNoMatch() { var orm = GetDomainInspectorMock(); var pattern = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object); var property = new PropertyPath(null, ForClass <MyClass> .Property(mc => mc.DicChildren)); pattern.Match(property).Should().Be.False(); }
public void WhenDictionarySeemsBidirectionalWithPropExclusionThenMatch() { var orm = GetDomainInspectorMockWithBidiPropExclusion(); var pattern = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object); var property = new PropertyPath(null, ConfOrm.ForClass <MyClass> .Property(mc => mc.DicChildren)); pattern.Match(property).Should().Be.True(); }
public void WhenCollectionUnidirectionalThenMatch() { var orm = GetDomainInspectorMock(); var pattern = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object); var property = new PropertyPath(null, ForClass <MyClass> .Property(mc => mc.Relateds)); pattern.Match(property).Should().Be.True(); }
public void WhenMultipleUsageBehindAComponentThenMatch() { var orm = GetDomainInspectorMockForBaseTests(); var applier = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object); var componentProperty = new PropertyPath(null, ForClass<Contact>.Property(x => x.Component1)); var property = new PropertyPath(componentProperty, ForClass<MyComponent>.Property(x => x.PastPositions)); applier.Match(property).Should().Be.True(); }
public void WhenNoPropertyThenNoMatch() { var orm = new Mock <IDomainInspector>(); orm.Setup(x => x.IsPersistentProperty(It.IsAny <MemberInfo>())).Returns(true); var pattern = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object); pattern.Match(null).Should().Be.False(); }
public void WhenSingleUsageThenNoMatch() { var orm = GetDomainInspectorMockForBaseTests(); var applier = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object); var property = new PropertyPath(null, ConfOrm.ForClass <MySingleUsage> .Property(x => x.CurrentPositions)); applier.Match(property).Should().Be.False(); }
public void WhenMultipleUsageBehindAComponentThenMatch() { var orm = GetDomainInspectorMockForBaseTests(); var applier = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object); var componentProperty = new PropertyPath(null, ForClass <Contact> .Property(x => x.Component)); var property = new PropertyPath(componentProperty, ForClass <MyComponent> .Property(x => x.PastPositions)); applier.Match(property).Should().Be.True(); }
public void WhenSingleCirsularRelationOnComponentThenNoMatch() { var orm = new Mock <IDomainInspector>(); orm.Setup(x => x.IsPersistentProperty(It.IsAny <MemberInfo>())).Returns(true); orm.Setup(dm => dm.IsOneToMany(typeof(Node), typeof(Node))).Returns(true); var applier = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object); var property = new PropertyPath(null, ConfOrm.ForClass <Node> .Property(x => x.Nodes)); applier.Match(property).Should().Be.False(); }
public void WhenMultipleUsageThenMatch() { var orm = GetDomainInspectorMockForBaseTests(); var applier = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object); var property1 = new PropertyPath(null, ConfOrm.ForClass <Contact> .Property(x => x.CurrentPositions)); applier.Match(property1).Should().Be.True(); var property2 = new PropertyPath(null, ConfOrm.ForClass <Contact> .Property(x => x.PastPositions)); applier.Match(property2).Should().Be.True(); }
public void ApplyPropertyPathAndPostFixForPastPositions() { var orm = new Mock<IDomainInspector>(); var applier = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object); var collectionMapper = new Mock<ICollectionPropertiesMapper>(); var keyMapper = new Mock<IKeyMapper>(); collectionMapper.Setup(x => x.Key(It.IsAny<Action<IKeyMapper>>())).Callback<Action<IKeyMapper>>( x => x.Invoke(keyMapper.Object)); var property = new PropertyPath(null, ForClass<Contact>.Property(x => x.PastPositions)); applier.Apply(property, collectionMapper.Object); keyMapper.Verify(km => km.Column(It.Is<string>(s => s == "ContactPastPositions_key"))); }
public void WhenSeemsDoubleCirsularRelationOnPolymorphicComponentWithNoPersistentCollectionThenNoMatch() { var orm = new Mock <IDomainInspector>(); orm.Setup(x => x.IsPersistentProperty(It.Is <MemberInfo>(m => !m.Equals(ConfOrm.ForClass <PolyNodeDouble> .Property(y => y.OthersNodes))))).Returns(true); orm.Setup(dm => dm.IsEntity(It.Is <Type>(t => t == typeof(PolyNodeDouble)))).Returns(true); orm.Setup(dm => dm.IsComponent(typeof(INode))).Returns(true); orm.Setup(dm => dm.IsOneToMany(typeof(PolyNodeDouble), typeof(INode))).Returns(true); var applier = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object); var property = new PropertyPath(null, ConfOrm.ForClass <PolyNodeDouble> .Property(x => x.Nodes)); applier.Match(property).Should().Be.False(); }
public void ApplyPropertyPathAndPostFixForCurrentPositions() { var orm = new Mock <IDomainInspector>(); var applier = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object); var collectionMapper = new Mock <ICollectionPropertiesMapper>(); var keyMapper = new Mock <IKeyMapper>(); collectionMapper.Setup(x => x.Key(It.IsAny <Action <IKeyMapper> >())).Callback <Action <IKeyMapper> >( x => x.Invoke(keyMapper.Object)); var property = new PropertyPath(null, ConfOrm.ForClass <Contact> .Property(x => x.CurrentPositions)); applier.Apply(property, collectionMapper.Object); keyMapper.Verify(km => km.Column(It.Is <string>(s => s == "ContactCurrentPositions_key"))); }
public void WhenNoPropertyThenNoMatch() { var orm = new Mock<IDomainInspector>(); var pattern = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object); pattern.Match(null).Should().Be.False(); }
public void WhenDictionaryUnidirectionalThenMatch() { var orm = GetDomainInspectorMock(); var pattern = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object); var property = new PropertyPath(null, ForClass<MyClass>.Property(mc => mc.DicRelateds)); pattern.Match(property).Should().Be.True(); }