public IPartnership AddPartnership(IFamilyMember partner1, IFamilyMember partner2, bool isDivorced = false)
        {
            var p1Exists = MemberExists(partner1);
            var p2Exists = MemberExists(partner2);

            if (!p1Exists || !p2Exists)
            {
                throw new NotInFamilyTreeException(!p1Exists ? partner1 : partner2);
            }

            var partnership = FamilyTreeFactory.CreatePartnership(partner1, partner2, isDivorced);

            IFamilyMember blood = null,
                          inlaw = null;

            inlaw = partner1.HasFact(FactType.InLaw) ? partner1 : partner2;
            blood = partnership.OtherPartner(inlaw);
            inlaw.AddFact(FactType.Depth, blood.Facts[FactType.Depth].Value);

            AddPartnership(partnership);

            return(partnership);
        }
Beispiel #2
0
 public FamilyMember()
 {
     NonPartnership = FamilyTreeFactory.CreateParentship(this);
 }