public void WhenNoGenericCollectionThenNoMatch()
 {
     var orm = new Mock<IDomainInspector>();
     var pattern = new CollectionOfElementsKeyColumnApplier(orm.Object);
     var path = new PropertyPath(null, ForClass<MyClass>.Property(p => p.Something));
     pattern.Match(path).Should().Be.False();
 }
예제 #2
0
        public void WhenNoGenericCollectionThenNoMatch()
        {
            var orm     = new Mock <IDomainInspector>();
            var pattern = new CollectionOfElementsKeyColumnApplier(orm.Object);
            var path    = new PropertyPath(null, ForClass <MyClass> .Property(p => p.Something));

            pattern.Match(path).Should().Be.False();
        }
예제 #3
0
        public void WhenNoRelationWithComponentThenMatch()
        {
            var orm            = new Mock <IDomainInspector>();
            var pattern        = new CollectionOfElementsKeyColumnApplier(orm.Object);
            var pathCollection = new PropertyPath(null, ForClass <MyComponent> .Property(p => p.Strings));

            pattern.Match(pathCollection).Should().Be.True();
        }
        public void WhenNoRelationWithComponentThenMatch()
        {
            var orm = new Mock<IDomainInspector>();
            var pattern = new CollectionOfElementsKeyColumnApplier(orm.Object);
            var pathCollection = new PropertyPath(null, ForClass<MyComponent>.Property(p => p.Strings));

            pattern.Match(pathCollection).Should().Be.True();
        }
        public void WhenRelationIsOneToManyForMapKeyThenNoMatch()
        {
            var orm = new Mock<IDomainInspector>();
            var pattern = new CollectionOfElementsKeyColumnApplier(orm.Object);
            orm.Setup(x => x.IsManyToMany(It.Is<Type>(t => t == typeof(MyClass)), It.Is<Type>(t => t == typeof(MyRelated)))).Returns(true);
            var path = new PropertyPath(null, ForClass<MyClass>.Property(p => p.MapRelationOnKey));

            pattern.Match(path).Should().Be.False();
        }
예제 #6
0
        public void WhenRelationIsManyToManyThenNoMatch()
        {
            var orm     = new Mock <IDomainInspector>();
            var pattern = new CollectionOfElementsKeyColumnApplier(orm.Object);

            orm.Setup(x => x.IsManyToMany(It.Is <Type>(t => t == typeof(MyClass)), It.Is <Type>(t => t == typeof(MyRelated)))).Returns(true);
            var path = new PropertyPath(null, ForClass <MyClass> .Property(p => p.Relateds));

            pattern.Match(path).Should().Be.False();
        }
        public void WhenRelationIsInPlainEntityThenApplyClassNameId()
        {
            var orm = new Mock<IDomainInspector>();
            var pattern = new CollectionOfElementsKeyColumnApplier(orm.Object);

            var mapper = new Mock<ICollectionPropertiesMapper>();
            var keyMapper = new Mock<IKeyMapper>();
            mapper.Setup(x => x.Key(It.IsAny<Action<IKeyMapper>>())).Callback<Action<IKeyMapper>>(
                x => x.Invoke(keyMapper.Object));
            var path = new PropertyPath(null, ForClass<MyClass>.Property(p => p.Strings));

            pattern.Apply(path, mapper.Object);
            keyMapper.Verify(km => km.Column(It.Is<string>(s => s == "MyClassId")));
        }
예제 #8
0
        public void WhenRelationIsInPlainEntityThenApplyClassNameId()
        {
            var orm     = new Mock <IDomainInspector>();
            var pattern = new CollectionOfElementsKeyColumnApplier(orm.Object);

            var mapper    = new Mock <ICollectionPropertiesMapper>();
            var keyMapper = new Mock <IKeyMapper>();

            mapper.Setup(x => x.Key(It.IsAny <Action <IKeyMapper> >())).Callback <Action <IKeyMapper> >(
                x => x.Invoke(keyMapper.Object));
            var path = new PropertyPath(null, ForClass <MyClass> .Property(p => p.Strings));

            pattern.Apply(path, mapper.Object);
            keyMapper.Verify(km => km.Column(It.Is <string>(s => s == "MyClassId")));
        }