Beispiel #1
0
        private void AddSpouse(string name, string spouseName)
        {
            var spousesPartner = _personLookupCache.GetPerson(name);

            if (spousesPartner != null)
            {
                var genderOfSpouse = spousesPartner.IsMale ? Gender.Female : Gender.Male;
                var spouse         = Person.Create(spouseName, genderOfSpouse);
                _personLookupCache.AddPerson(spouse);

                spousesPartner.SetSpouse(spouse);
            }
            else
            {
                throw new PersonUnknownException($"Person named {name} is unknown");
            }
        }
Beispiel #2
0
 private Person WhenAnUnknownPersonIsLookedup()
 {
     return(_personLookupCache.GetPerson("John"));
 }
 private Person WhenAPersonInTheCacheIsLookedup()
 {
     return(_personLookupCache.GetPerson("Jane"));
 }