public void WhenMultipleUsageThenMatch()
        {
            var orm = GetDomainInspectorMockForBaseTests();

            var applier = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object);
            var property1 = new PropertyPath(null, ForClass<Contact>.Property(x => x.CurrentPositions));
            applier.Match(property1).Should().Be.True();

            var property2 = new PropertyPath(null, ForClass<Contact>.Property(x => x.PastPositions));
            applier.Match(property2).Should().Be.True();
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        public void WhenNoPropertyThenNoMatch()
        {
            var orm     = new Mock <IDomainInspector>();
            var pattern = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object);

            pattern.Match(null).Should().Be.False();
        }
 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();
 }
Esempio n. 5
0
        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();
        }
Esempio n. 6
0
        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();
        }
Esempio n. 7
0
        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 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();
        }
Esempio n. 9
0
        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();
        }
Esempio n. 10
0
        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();
        }
Esempio n. 11
0
        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();
        }
Esempio n. 12
0
        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();
        }
Esempio n. 13
0
        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();
        }
Esempio n. 14
0
        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 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();
        }
 public void WhenNoPropertyThenNoMatch()
 {
     var orm = new Mock<IDomainInspector>();
     var pattern = new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm.Object);
     pattern.Match(null).Should().Be.False();
 }