internal PersonalRelationship(Person relatedPerson, PersonalRelationshipType personalRelationshipType, Guid referenceId, string description = "") : base(personalRelationshipType, referenceId)
        {
            if (relatedPerson == null)
            {
                throw new ArgumentNullException(nameof(relatedPerson), @"You should know that a relationship needs two parties to be established...");
            }

            RelatedPerson = relatedPerson;
            Description   = description;

            ItemType = MemoryItemType.PersonalRelationship;
        }
Ejemplo n.º 2
0
        public void SetUp()
        {
            _mockDatabaseGateway          = new Mock <IDatabaseGateway>();
            _personalRelationshipsUseCase = new PersonalRelationshipsUseCase(_mockDatabaseGateway.Object);

            _mockDatabaseGateway.Setup(x => x.GetPersonalRelationshipTypeByDescription(_typeInRequest.Description))
            .Returns(_typeInRequest);

            _request = PersonalRelationshipsHelper.CreatePersonalRelationshipRequest(type: _typeInRequest.Description);

            _person      = TestHelpers.CreatePerson(_request.PersonId);
            _otherPerson = TestHelpers.CreatePerson(_request.OtherPersonId);

            _typeInExistingRelationship = PersonalRelationshipsHelper.CreatePersonalRelationshipType("partner");

            _relationship = PersonalRelationshipsHelper.CreatePersonalRelationship(_person, _otherPerson, _typeInExistingRelationship);
            _rel_details  = PersonalRelationshipsHelper.CreatePersonalRelationshipDetail(_relationship.Id, "some details for the relationship");
        }
        /// <inheritdoc />
        public override MemoryItem GetInaccurateCopy()
        {
            GameTime.GameTime        started = Started;
            GameTime.GameTime        ended   = Ended;
            PersonalRelationshipType type    = Type;

            //TODO : Randomize name

            int falsificationCase = RandomValueGenerator.GenerateIntWithMaxValue(4);

            switch (falsificationCase)
            {
            case 1:
                int variance = RandomValueGenerator.GenerateRealWithinValues(-10, 10);
                started?.SetYear(started.GetYear() + variance);
                break;

            case 2:
                int deathVariance = RandomValueGenerator.GenerateRealWithinValues(-10, 10);
                ended?.SetYear(ended.GetYear() + deathVariance);
                break;

            case 3:
                type = (PersonalRelationshipType)RandomValueGenerator.GenerateIntWithMaxValue(Enum.GetNames(typeof(PersonalRelationshipType)).Length);
                break;

            case 4:
                type     = (PersonalRelationshipType)RandomValueGenerator.GenerateIntWithMaxValue(Enum.GetNames(typeof(PersonalRelationshipType)).Length);
                variance = RandomValueGenerator.GenerateRealWithinValues(-10, 10);
                started?.SetYear(started.GetYear() + variance);
                break;
            }

            var copy = new PersonalRelationship(RelatedPerson, type, ReferenceId)
            {
                ItemType    = ItemType,
                Description = Description,
                Started     = started,
                Ended       = ended,
                Name        = Name
            };

            return(copy);
        }
 public static PersonalRelationship CreatePersonalRelationship(
     Person person,
     Person otherPerson,
     PersonalRelationshipType type,
     bool hasEnded = false,
     long?id       = null
     )
 {
     return(new Faker <PersonalRelationship>()
            .RuleFor(pr => pr.Id, f => id ?? f.UniqueIndex)
            .RuleFor(pr => pr.PersonId, person.Id)
            .RuleFor(pr => pr.OtherPersonId, otherPerson.Id)
            .RuleFor(pr => pr.OtherPerson, otherPerson)
            .RuleFor(pr => pr.TypeId, type.Id)
            .RuleFor(pr => pr.Type, type)
            .RuleFor(pr => pr.StartDate, f => f.Date.Past())
            .RuleFor(pr => pr.EndDate, f => hasEnded ? f.Date.Future() : (DateTime?)null)
            .RuleFor(pr => pr.IsInformalCarer, f => f.Random.String2(1, "YN"))
            .RuleFor(pr => pr.ParentalResponsibility, f => f.Random.String2(1, "YN")));
 }
 public PersonalRelationshipInformation(string description, PersonalRelationshipType type)
 {
     Description = description;
     Type        = type;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Returns the relationship of a person for a certain type, i.e. friends or family members.
 /// </summary>
 /// <param name="type">Type of relationship desired</param>
 /// <returns>A list of relationships of the applicable type</returns>
 public List <PersonalRelationship> FindRelationshipsByType(PersonalRelationshipType type)
 {
     return(_relationships.Where(r => r.Type == type).ToList());
 }
        public override void ChangeType(Enum newType)
        {
            var type = (PersonalRelationshipType)newType;

            Type = type;
        }