116 lines
7.2 KiB
C#
116 lines
7.2 KiB
C#
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 personKeyFormatted) =>
|
|
GetDateTime(personKeyFormatted);
|
|
static string GetDateTime(string personKeyFormatted) =>
|
|
personKeyFormatted.Length < 5 || !personKeyFormatted.Contains('#') ? personKeyFormatted : personKeyFormatted[..2] == "19" ? $"1600{personKeyFormatted[4..]}" : $"1700{personKeyFormatted[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 personKeyFormatted) =>
|
|
GetPersonBirthday(personBirthdayFormat, personKeyFormatted);
|
|
static Models.PersonBirthday? GetPersonBirthday(string personBirthdayFormat, string personKeyFormatted) =>
|
|
PersonBirthday.GetPersonBirthday(personBirthdayFormat, personKeyFormatted);
|
|
|
|
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);
|
|
static bool DoesBirthDateExits(Properties.IStorage storage, string personBirthdayFormat, Models.PersonBirthday personBirthday) =>
|
|
File.Exists(GetFileFullName(storage, personBirthdayFormat, personBirthday));
|
|
|
|
DateTime? TestStatic_GetDateTime(string personBirthdayFormat, string personKeyFormatted) =>
|
|
GetDateTime(personBirthdayFormat, personKeyFormatted);
|
|
static DateTime? GetDateTime(string personBirthdayFormat, string personKeyFormatted) =>
|
|
DateTime.TryParseExact(GetDateTime(personKeyFormatted), personBirthdayFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dateTime) ? dateTime : null;
|
|
|
|
List<(string, Models.PersonBirthday)> TestStatic_GetPersonBirthdays(string personBirthdayFormat, string[] personKeyDirectories, string personDisplayDirectory, string personDisplayDirectoryName) =>
|
|
GetPersonBirthdays(personBirthdayFormat, personKeyDirectories, personDisplayDirectory, personDisplayDirectoryName);
|
|
static List<(string, Models.PersonBirthday)> GetPersonBirthdays(string personBirthdayFormat, string[] personKeyDirectories, string personDisplayDirectory, string personDisplayDirectoryName) =>
|
|
PersonBirthday.GetPersonBirthdays(personBirthdayFormat, personKeyDirectories, personDisplayDirectory, personDisplayDirectoryName);
|
|
|
|
} |