private void AddPersonalIdentityNumberProperties(Dictionary <string, string> properties, Dictionary <string, double> metrics, PersonalIdentityNumber personalIdentityNumber) { if (_options.LogUserPersonalIdentityNumber) { properties.Add(PropertyName_UserSwedishPersonalIdentityNumber, personalIdentityNumber?.To12DigitString() ?? string.Empty); } if (_options.LogUserPersonalIdentityNumberHints) { properties.Add(PropertyName_UserDateOfBirthHint, personalIdentityNumber?.GetDateOfBirthHint().ToString("yyyy-MM-dd") ?? string.Empty); properties.Add(PropertyName_UserGenderHint, personalIdentityNumber?.GetGenderHint().ToString() ?? string.Empty); var ageHint = personalIdentityNumber?.GetAgeHint(); if (ageHint != null) { metrics.Add(PropertyName_UserAgeHint, ageHint.Value); } } }
public void When_Last_Digit_In_birthNumber_Is_Odd_It_Is_A_Man(int year, int month, int day, int birthNumber, int checksum) { var personalIdentityNumber = new PersonalIdentityNumber(year, month, day, birthNumber, checksum); Assert.Equal(Gender.Male, personalIdentityNumber.GetGenderHint()); }