コード例 #1
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();
 }
コード例 #2
0
        public void WhenRelationDeclaredAsManyToManyUnidirectionalThenMatch()
        {
            var orm = new Mock<IDomainInspector>();
            orm.Setup(x => x.IsManyToMany(It.Is<Type>(t => t == typeof(MyClass)), It.Is<Type>(t => t == typeof(MyOtherClass)))).Returns(true);

            var pattern = new ManyToManyPattern(orm.Object);
            pattern.Match(ForClass<MyClass>.Property(x => x.MyOtherClasses)).Should().Be.True();
        }
コード例 #3
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();
        }
コード例 #4
0
        public void WhenRelationDeclaredAsManyToManyForDictionaryValueThenMatch()
        {
            var orm = new Mock <IDomainInspector>();

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

            var pattern = new ManyToManyPattern(orm.Object);

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