public void WhenRelationNotDeclaredAsManyToManyUnidirectionalThenNoMatch()
 {
     var orm = new Mock<IDomainInspector>();
     var pattern = new ManyToManyPattern(orm.Object);
     pattern.Match(ForClass<MyClass>.Property(x => x.MyOtherClasses)).Should().Be.False();
     pattern.Match(ForClass<MyClass>.Property(x => x.MyBidirects)).Should().Be.False();
     pattern.Match(ForClass<MyBidirect>.Property(x => x.MyClasses)).Should().Be.False();
 }
Exemplo n.º 2
0
        public void WhenRelationNotDeclaredAsManyToManyUnidirectionalThenNoMatch()
        {
            var orm     = new Mock <IDomainInspector>();
            var pattern = new ManyToManyPattern(orm.Object);

            pattern.Match(ForClass <MyClass> .Property(x => x.MyOtherClasses)).Should().Be.False();
            pattern.Match(ForClass <MyClass> .Property(x => x.MyBidirects)).Should().Be.False();
            pattern.Match(ForClass <MyBidirect> .Property(x => x.MyClasses)).Should().Be.False();
        }
        public void WhenRelationDeclaredAsManyToManyBidirectionalThenMatch()
        {
            var orm = new Mock<IDomainInspector>();
            orm.Setup(x => x.IsManyToMany(It.Is<Type>(t => t == typeof(MyClass)), It.Is<Type>(t => t == typeof(MyBidirect)))).Returns(true);
            orm.Setup(x => x.IsManyToMany(It.Is<Type>(t => t == typeof(MyBidirect)), It.Is<Type>(t => t == typeof(MyClass)))).Returns(true);

            var pattern = new ManyToManyPattern(orm.Object);

            pattern.Match(ForClass<MyClass>.Property(x => x.MyBidirects)).Should().Be.True();
            pattern.Match(ForClass<MyBidirect>.Property(x => x.MyClasses)).Should().Be.True();
        }
Exemplo n.º 4
0
        public void WhenRelationDeclaredAsManyToManyBidirectionalThenMatch()
        {
            var orm = new Mock <IDomainInspector>();

            orm.Setup(x => x.IsManyToMany(It.Is <Type>(t => t == typeof(MyClass)), It.Is <Type>(t => t == typeof(MyBidirect)))).Returns(true);
            orm.Setup(x => x.IsManyToMany(It.Is <Type>(t => t == typeof(MyBidirect)), It.Is <Type>(t => t == typeof(MyClass)))).Returns(true);

            var pattern = new ManyToManyPattern(orm.Object);

            pattern.Match(ForClass <MyClass> .Property(x => x.MyBidirects)).Should().Be.True();
            pattern.Match(ForClass <MyBidirect> .Property(x => x.MyClasses)).Should().Be.True();
        }