using System.Globalization; namespace View_by_Distance.Shared.Models.Stateless.Methods; public interface IPersonBirthday { DateTime TestStatic_GetDefaultValue() => GetDefaultValue(); static DateTime GetDefaultValue() => DateTime.MinValue; // {{1}}SingletonValue // ... string TestStatic_GetDateTime(string personKey) => GetDateTime(personKey); static string GetDateTime(string personKey) => personKey.Length < 5 || !personKey.Contains('#') ? personKey : personKey[..2] == "19" ? $"1600{personKey[4..]}" : $"1700{personKey[4..]}"; double? TestStatic_GetAge(Models.PersonBirthday birthday) => GetAge(birthday); static double? GetAge(Models.PersonBirthday birthday) => PersonBirthday.GetAge(birthday); Models.PersonBirthday TestStatic_GetPersonBirthday(long ticks) => new(new(ticks)); static Models.PersonBirthday GetPersonBirthday(long ticks) => new(new(ticks)); string TestStatic_GetFileName(string personBirthdayFormat, Models.PersonBirthday personBirthday) => GetFileName(personBirthdayFormat, personBirthday); static string GetFileName(string personBirthdayFormat, Models.PersonBirthday personBirthday) => $"{personBirthday.Value.ToString(personBirthdayFormat)}.json"; (int, TimeSpan) TestStatic_GetAge(DateTime dateTime, Models.PersonBirthday birthday) => GetAge(dateTime, birthday); static (int, TimeSpan) GetAge(DateTime dateTime, Models.PersonBirthday birthday) => PersonBirthday.GetAge(dateTime, birthday); (int, TimeSpan) TestStatic_GetAge(long dateTimeTicks, Models.PersonBirthday birthday) => GetAge(dateTimeTicks, birthday); static (int, TimeSpan) GetAge(long dateTimeTicks, Models.PersonBirthday birthday) => PersonBirthday.GetAge(dateTimeTicks, birthday); string TestStatic_GetFormatted(string personBirthdayFormat, Models.PersonBirthday personBirthday) => GetFormatted(personBirthdayFormat, personBirthday); static string GetFormatted(string personBirthdayFormat, Models.PersonBirthday personBirthday) => personBirthday.Value.ToString(personBirthdayFormat); string TestStatic_GetFormatted(string personBirthdayFormat, long personKey) => GetFormatted(personBirthdayFormat, personKey); static string GetFormatted(string personBirthdayFormat, long personKey) => GetFormatted(personBirthdayFormat, GetPersonBirthday(personKey)); bool TestStatic_IsCounterPersonBirthday(Models.PersonBirthday personBirthday) => IsCounterPersonBirthday(personBirthday); static bool IsCounterPersonBirthday(Models.PersonBirthday personBirthday) => PersonBirthday.IsCounterPersonBirthday(personBirthday); Models.PersonBirthday TestStatic_GetNextBirthDate(Properties.IStorage storage) => GetNextBirthDate(storage); static Models.PersonBirthday GetNextBirthDate(Properties.IStorage storage) => throw new Exception(storage.ToString()); // Person.GetNextBirthDate(storage); TimeSpan? TestStatic_Get(DateTime minimumDateTime, Models.PersonBirthday personBirthday) => GetTimeSpan(minimumDateTime, isWrongYear: false, personBirthday); static TimeSpan? GetTimeSpan(DateTime minimumDateTime, Models.PersonBirthday personBirthday) => PersonBirthday.GetTimeSpan(minimumDateTime, isWrongYear: false, personBirthday); Models.PersonBirthday? TestStatic_GetPersonBirthday(string personBirthdayFormat, string personKey) => GetPersonBirthday(personBirthdayFormat, personKey); static Models.PersonBirthday? GetPersonBirthday(string personBirthdayFormat, string personKey) => PersonBirthday.GetPersonBirthday(personBirthdayFormat, personKey); bool TestStatic_DoesBirthDateExits(Properties.IStorage storage, Models.PersonBirthday personBirthday) => DoesBirthDateExits(storage, personBirthday); static bool DoesBirthDateExits(Properties.IStorage storage, Models.PersonBirthday personBirthday) => DoesBirthDateExits(storage, personBirthday); TimeSpan? TestStatic_Get(long minimumDateTimeTicks, bool? isWrongYear, Models.PersonBirthday personBirthday) => GetTimeSpan(minimumDateTimeTicks, isWrongYear, personBirthday); static TimeSpan? GetTimeSpan(long minimumDateTimeTicks, bool? isWrongYear, Models.PersonBirthday personBirthday) => PersonBirthday.GetTimeSpan(minimumDateTimeTicks, isWrongYear, personBirthday); TimeSpan? TestStatic_Get(DateTime minimumDateTime, bool? isWrongYear, Models.PersonBirthday personBirthday) => GetTimeSpan(minimumDateTime, isWrongYear, personBirthday); static TimeSpan? GetTimeSpan(DateTime minimumDateTime, bool? isWrongYear, Models.PersonBirthday personBirthday) => PersonBirthday.GetTimeSpan(minimumDateTime, isWrongYear, personBirthday); bool TestStatic_IsWrongYearFilterOrCounterPersonBirthday(bool? isWrongYear, Models.PersonBirthday personBirthday) => IsWrongYearFilterOrCounterPersonBirthday(isWrongYear, personBirthday); static bool IsWrongYearFilterOrCounterPersonBirthday(bool? isWrongYear, Models.PersonBirthday personBirthday) => PersonBirthday.IsWrongYearFilterOrCounterPersonBirthday(isWrongYear, personBirthday); string TestStatic_GetFileFullName(Properties.IStorage storage, string personBirthdayFormat, Models.PersonBirthday personBirthday) => GetFileFullName(storage, personBirthdayFormat, personBirthday); static string GetFileFullName(Properties.IStorage storage, string personBirthdayFormat, Models.PersonBirthday personBirthday) => Path.Combine(storage.PeopleRootDirectory, "{}", GetFileName(personBirthdayFormat, personBirthday)); bool TestStatic_DoesBirthDateExits(Properties.IStorage storage, string personBirthdayFormat, Models.PersonBirthday personBirthday) => DoesBirthDateExits(storage, personBirthdayFormat, personBirthday); internal static bool DoesBirthDateExits(Properties.IStorage storage, string personBirthdayFormat, Models.PersonBirthday personBirthday) => File.Exists(GetFileFullName(storage, personBirthdayFormat, personBirthday)); DateTime? TestStatic_GetDateTime(string personBirthdayFormat, string personKey) => GetDateTime(personBirthdayFormat, personKey); static DateTime? GetDateTime(string personBirthdayFormat, string personKey) => DateTime.TryParseExact(GetDateTime(personKey), personBirthdayFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dateTime) ? dateTime : null; }