public void WhenNotDeclaredExplicitOneToOneThenNoMatch()
 {
     var edo = new ExplicitDeclarationsHolder();
     var relation = new Relation(typeof(MyClass), typeof(MyOneClass));
     var pattern = new OneToOneUnidirectionalToManyToOnePattern(edo);
     pattern.Match(relation).Should().Be.False();
 }
 public void WhenDeclaredExplicitOneToOneAndIsUnirectionalThenMatch()
 {
     var edo = new ExplicitDeclarationsHolder();
     var relation = new Relation(typeof (MyClass), typeof (MyOneClass));
     edo.OneToOneRelations.Add(relation);
     var pattern = new OneToOneUnidirectionalToManyToOnePattern(edo);
     pattern.Match(relation).Should().Be.True();
 }
        public bool Equals(Relation that)
        {
            if(ReferenceEquals(null, that))
            {
                return false;
            }

            return From.Equals(that.From) && To.Equals(that.To);
        }
        public bool IsMasterOneToOne(Type from, Type to)
        {
            Relation relation = explicitDeclarations.OneToOneRelations.SingleOrDefault(oto => oto.Equals(new Relation(from, to)));

            return(relation != null && relation.DeclaredAs == Declared.Explicit);
        }
        public virtual bool IsOneToOne(Type from, Type to)
        {
            var relation = new Relation(from, to);

            return(IsEntity(from) && IsEntity(to) && explicitDeclarations.OneToOneRelations.Contains(relation) && !Patterns.ManyToOneRelations.Match(relation));
        }