86 lines
4.5 KiB
C#
86 lines
4.5 KiB
C#
using System.Data;
|
|
|
|
namespace Server.WatchBody.Core.Tests;
|
|
|
|
/// <summary>Заготовки DataTable для фейк-транспорта (d-tst-4: один DataTable = один конвертер).</summary>
|
|
internal static class TestInfra
|
|
{
|
|
public static DataTable Table((string Name, Type Type)[] columns, params object?[][] rows)
|
|
{
|
|
var table = new DataTable();
|
|
foreach (var (name, type) in columns)
|
|
{
|
|
table.Columns.Add(name, type);
|
|
}
|
|
foreach (var row in rows)
|
|
{
|
|
table.Rows.Add(row);
|
|
}
|
|
return table;
|
|
}
|
|
|
|
public static readonly (string, Type)[] AthleteCols =
|
|
[("id", typeof(int)), ("name", typeof(string)), ("api_key_hash", typeof(string)),
|
|
("is_blocked", typeof(bool)), ("created_at", typeof(DateTime))];
|
|
|
|
public static readonly (string, Type)[] ProfileCols =
|
|
[("id", typeof(int)), ("athlete_id", typeof(int)), ("sex", typeof(string)),
|
|
("birth_year", typeof(int)), ("weight_kg", typeof(decimal)), ("hr_max", typeof(int)),
|
|
("updated_at", typeof(DateTime))];
|
|
|
|
public static readonly (string, Type)[] ExerciseCols =
|
|
[("id", typeof(Guid)), ("athlete_id", typeof(int)), ("name", typeof(string)),
|
|
("group_id", typeof(int)), ("is_base", typeof(bool)), ("is_active", typeof(bool)),
|
|
("replacement_ids", typeof(string))];
|
|
|
|
public static readonly (string, Type)[] ProgramCols =
|
|
[("id", typeof(int)), ("athlete_id", typeof(int)), ("title", typeof(string)),
|
|
("external_id", typeof(string)), ("created_at", typeof(DateTime)),
|
|
("active_version_id", typeof(Guid)), ("active_version", typeof(int))];
|
|
|
|
public static readonly (string, Type)[] VersionCols =
|
|
[("id", typeof(Guid)), ("program_id", typeof(int)), ("version", typeof(int)),
|
|
("based_on_version", typeof(int)), ("status", typeof(string)), ("author", typeof(string)),
|
|
("rationale", typeof(string)), ("created_at", typeof(DateTime))];
|
|
|
|
public static readonly (string, Type)[] WorkoutCols =
|
|
[("id", typeof(Guid)), ("athlete_id", typeof(int)), ("program_version_id", typeof(Guid)),
|
|
("started_at", typeof(DateTime)), ("ended_at", typeof(DateTime)), ("status", typeof(string)),
|
|
("session_kind", typeof(string)), ("avg_hr", typeof(int)), ("facts_json", typeof(string)),
|
|
("fit_file_id", typeof(string)), ("hr_recovery_s", typeof(int)), ("sets", typeof(string)),
|
|
("commands", typeof(string))];
|
|
|
|
public static readonly (string, Type)[] SetCols =
|
|
[("id", typeof(Guid)), ("workout_id", typeof(Guid)), ("athlete_id", typeof(int)),
|
|
("exercise_id", typeof(Guid)), ("seq", typeof(int)), ("weight_kg", typeof(decimal)),
|
|
("reps", typeof(int)), ("done_at", typeof(DateTime)), ("source", typeof(string)),
|
|
("in_plan", typeof(bool)), ("rpe", typeof(int)), ("knee_pain", typeof(int))];
|
|
|
|
public static readonly (string, Type)[] CommandCols =
|
|
[("id", typeof(Guid)), ("workout_id", typeof(Guid)), ("t_offset_s", typeof(int)),
|
|
("recognized_text", typeof(string)), ("semantics", typeof(string)), ("accepted", typeof(bool))];
|
|
|
|
public static readonly (string, Type)[] DailyLogCols =
|
|
[("id", typeof(Guid)), ("athlete_id", typeof(int)), ("date", typeof(DateTime)),
|
|
("bp_sys", typeof(int)), ("bp_dias", typeof(int)), ("weight_kg", typeof(decimal)),
|
|
("hr_resting", typeof(int)), ("waist_cm", typeof(decimal)), ("sleep_h", typeof(decimal)),
|
|
("wellbeing", typeof(int))];
|
|
|
|
public static readonly (string, Type)[] MetricsCols =
|
|
[("id", typeof(int)), ("workout_id", typeof(Guid)), ("athlete_id", typeof(int)),
|
|
("adherence", typeof(decimal)), ("tonnage", typeof(decimal)), ("tonnage_by_group", typeof(string)),
|
|
("e1pm_by_exercise", typeof(string)), ("hr_metrics", typeof(string)), ("red_flags", typeof(string)),
|
|
("computed_at", typeof(DateTime)), ("started_at", typeof(DateTime))];
|
|
|
|
public static readonly (string, Type)[] BreakCols =
|
|
[("id", typeof(Guid)), ("athlete_id", typeof(int)), ("kind", typeof(string)),
|
|
("source", typeof(string)), ("started_on", typeof(DateTime)), ("planned_return", typeof(DateTime)),
|
|
("ended_on", typeof(DateTime)), ("note", typeof(string))];
|
|
|
|
public static readonly (string, Type)[] MigrationCols =
|
|
[("id", typeof(int)), ("filename", typeof(string)), ("applied_at", typeof(DateTime))];
|
|
|
|
public static readonly (string, Type)[] GroupCols =
|
|
[("id", typeof(int)), ("code", typeof(string)), ("title", typeof(string))];
|
|
}
|