private void LoadAssociationType(Association association)
 {
     if (Entity.IsNull(association.Type))
     {
         throw new BadRequestException("AssociationType can not be null");
     }
     association.Type = repository.Load<AssociationType>(association.Type.Id);
 }
        public void SetUp()
        {
            testDataHelper = new TestDataHelper();

            constituent = testDataHelper.CreateConstituent(ConstituentMother.ConstituentWithName(ConstituentNameMother.JamesFranklin()));
            reciprocalConstituent = testDataHelper.CreateConstituent(ConstituentMother.ConstituentWithName(ConstituentNameMother.AgnesAlba()));
            savedAssociation = testDataHelper.CreateAssociation(AsociationMother.JamesFranklinAndJessicaAlba(constituent,reciprocalConstituent));
        }
        public void SetUp()
        {
            testDataHelper = new TestDataHelper();
            var constituent = ConstituentMother.ConstituentWithName(ConstituentNameMother.JamesFranklin());
            savedConstituent = testDataHelper.CreateConstituent(constituent);

            constituent = ConstituentMother.ConstituentWithName(ConstituentNameMother.AgnesAlba());
            savedAssociatedConstituent = testDataHelper.CreateConstituent(constituent);

            savedAssociation = testDataHelper.CreateAssociation(AsociationMother.JamesFranklinAndParent(savedConstituent));

            associationRepository = new AssociationRepository(testDataHelper.session);
        }
 public virtual void CreateReciprocal()
 {
     if(IsHardAssociation())
     ReciprocalAssociation = new Association()
                {
                    Constituent = AssociatedConstituent,
                    AssociatedConstituent = Constituent,
                    AssociatedConstituentName = AssociatedConstituentName,
                    StartDate = StartDate,
                    EndDate = EndDate,
                    ReciprocalAssociation = ReciprocalAssociation,
                    Type = Type.ReciprocalType
                };
 }
 public Association UpdateAssociation(Association associaton)
 {
     LoadAssociationType(associaton);
     return repository.Update(associaton);
 }
 public Association CreateAssociation(Association association)
 {
     LoadAssociationType(association);
     association.CreateReciprocal();
     return repository.Save(association);
 }