1.6 KiB
1.6 KiB
Тесты AthleteProfileRepository (слой Src)
Репозиторий
Server.WatchBody.Core.Dal.Src.Repository: IAthleteProfileRepository / AthleteProfileRepository (правила — c-dal; концепция unit-тестов без БД — c-tst, d-tst).
Методы → функции БД
| Метод | Транспорт | Функция БД |
|---|---|---|
Upsert(AthleteProfile) |
scalar int | src.athlete_profile_upsert(p_athlete_id, p_sex, p_birth_year, p_weight_kg, p_hr_max) |
Get(int athleteId) |
reader | src.athlete_profile_get(p_athlete_id) |
Механика теста (общая)
ConnectionStringTest (d-tst-11); проверки в момент вызова; 1 тест =
1 вызов (d-tst-13). Nullable-поля профиля передаются
AddParameterNullable (NULL ≡ DBNull).
Заготовки (DataTable)
Таблица ответа athlete_profile_get: id:int, athlete_id:int, sex:string?,
birth_year:int?, weight_kg:decimal?, hr_max:int?, updated_at:DateTime.
Строки-фикстуры: p1 — athlete 1, m, 1978, 158.0, hr_max NULL.
Тесты: Upsert
| № | Тип | Условие | Ожидаемый результат |
|---|---|---|---|
| 1 | основной | p1 (hr_max = null); scalar = 3 | Upsert→3; hr_max передан как DBNull |
Тесты: Get
| № | Тип | Условие | Ожидаемый результат |
|---|---|---|---|
| 1 | основной | таблица [p1] | сущность; HrMax = null; WeightKg = 158.0 |
| 2 | граничный | пустая таблица | null |