=== Summary: 675 files | 7 generated | 484 fresh | 4605 untracked | 4268 adopted | 355 marked | 466 validated-ok | 2+0 stale (sig+body) | 0 skipped | 0 failed | elapsed 11:08:11.442 (40091.44s) ===

This commit is contained in:
julian
2026-06-28 02:50:05 -07:00
parent a19fb90902
commit 586f02a2ca
654 changed files with 5260 additions and 0 deletions
@@ -50,6 +50,7 @@ public class PumpServiceTest
/// <summary>
/// Initializes the unit test fixture by creating mock repositories, services, and a mocked <see cref="HttpContext"/> with a test claims principal, then instantiates the <see cref="PumpService"/> under test using the configured API settings (5-second pump expiration, zero pump messages disabled). Pass-through mappings are configured for <see cref="ICalculatedObservationsService"/>, <see cref="IConfigPumpsService"/>, and <see cref="IConfigUnitsService"/> so that supplied pump observations are returned unchanged.
/// </summary>
/// <!-- aidoc:v1 sig=dee8bf2 body=872fc6b -->
[SetUp]
public void Setup()
{
@@ -115,6 +116,7 @@ public class PumpServiceTest
/// Verifies that <see cref="ApiRequest"/> processing does not insert any <see cref="PumpObservation"/> records
/// when the request is saved without associated observations.
/// </summary>
/// <!-- aidoc:v1 sig=42b8c0e body=dd944a2 -->
[Test]
public async Task SaveRequest_Returns_When_No_Observations()
{
@@ -126,6 +128,7 @@ public class PumpServiceTest
/// <summary>
/// Verifies that <c>SaveRequest</c> does not insert a <see cref="PumpObservation"/> when the <see cref="ApiRequest.Type"/> is an unrecognized value.
/// </summary>
/// <!-- aidoc:v1 sig=f664650 body=4ef2165 -->
[Test]
public async Task SaveRequest_UnknownType_DoesNotInsert()
{
@@ -143,6 +146,7 @@ public class PumpServiceTest
/// Verifies that SaveRequest converts a single <c>PumpObservation</c> on an incoming
/// <c>ApiRequest</c> into a list with one entry on the request after processing.
/// </summary>
/// <!-- aidoc:v1 sig=ffee994 body=257a0a7 -->
[Test]
public async Task SaveRequest_Converts_SingleObservation_ToList()
{
@@ -164,6 +168,7 @@ public class PumpServiceTest
/// <summary>
/// Verifies that Service.SaveRequest sets the <c>Expires</c> property of the <see cref="PumpObservation"/> before persisting it via the repository.
/// </summary>
/// <!-- aidoc:v1 sig=f82c67c body=9a75bd3 -->
[Test]
public async Task SaveRequest_SetsExpires_BeforeInsert()
{
@@ -196,6 +201,7 @@ public class PumpServiceTest
/// and does not create a <see cref="PumpObservation"/>, ensuring alarm-phase events are
/// routed to the alarm event store rather than the observation store.
/// </summary>
/// <!-- aidoc:v1 sig=5d43d51 body=5d854f0 -->
[Test]
public async Task SaveRequest_ORU_R40_CreatesAlarmEvent()
{
@@ -221,6 +227,7 @@ public class PumpServiceTest
/// Verifies that processing a pump observation with <c>EventPhase.End</c> removes the corresponding alarm state
/// by calling <c>RemoveAsync</c> on the alarm state repository with the matching device, alarm type, and MDC code.
/// </summary>
/// <!-- aidoc:v1 sig=bc95230 body=ed3bff2 -->
[Test]
public async Task ProcessAlarm_End_RemovesAlarmState()
{
@@ -249,6 +256,7 @@ public class PumpServiceTest
/// Verifies that <c>SaveRequest</c> creates and upserts a new <see cref="PumpState"/>
/// for the device when no existing pump state is found in the repository.
/// </summary>
/// <!-- aidoc:v1 sig=a8ef24c body=b070da6 -->
[Test]
public async Task SaveRequest_CreatesPumpState_IfNotExists()
{
@@ -273,6 +281,7 @@ public class PumpServiceTest
/// Verifies that SaveRequest does not broadcast a message via the client when there are no active subscribers.
/// </summary>
/// <returns>A task that completes when the assertion has been executed.</returns>
/// <!-- aidoc:v1 sig=7b9c477 body=f817038 -->
[Test]
public async Task SaveRequest_NoSubscribers_NoBroadcast()
{
@@ -372,6 +381,7 @@ public class PumpServiceTest
/// <c>DeleteOlderThanDaysAsync</c> method with the configured retention value when the
/// retention policy returned for the pump observation is <c>DeleteOlderDays</c>.
/// </summary>
/// <!-- aidoc:v1 sig=d2dfd4d body=d351b0f -->
[Test]
public async Task SaveRequest_Retention_DeleteOlderDays_CallsRepo()
{
@@ -399,6 +409,7 @@ public class PumpServiceTest
/// Verifies that <c>GetPaginatedPump</c> returns the correct paginated results when filtering by patient identifier.
/// Ensures the first page contains the most recent observation within the configured time tolerance.
/// </summary>
/// <!-- aidoc:v1 sig=b7d70a0 body=0ac38ce -->
[Test]
public async Task GetPaginatedPump_ByPatient_Works()
{
@@ -434,6 +445,7 @@ public class PumpServiceTest
/// Verifies that <c>ArchiveByPatientId</c> inserts the patient's pump observations into the archive
/// repository and then deletes them, along with their related alarm events and alarm states.
/// </summary>
/// <!-- aidoc:v1 sig=7f95b21 body=fcc366d -->
[Test]
public async Task ArchiveByPatientId_InsertsArchive_ThenDeletes()
{
@@ -459,6 +471,7 @@ public class PumpServiceTest
/// Verifies that <c>UpdateManyObjectId</c> correctly updates the patient identifier across observations, alarms, and alarm state repositories.
/// </summary>
/// <returns>A task representing the asynchronous test execution.</returns>
/// <!-- aidoc:v1 sig=b51830b body=7584081 -->
[Test]
public async Task UpdateManyObjectId_UpdatesObs_Alarms_States()
{
@@ -483,6 +496,7 @@ public class PumpServiceTest
/// Verifies that <c>FindLastPumpObservations</c> returns pump observations ordered with the most recent first,
/// returning only the specified number of latest entries when the repository provides multiple observations.
/// </summary>
/// <!-- aidoc:v1 sig=7cbd1eb body=331060b -->
[Test]
public async Task FindLastPumpObservations_ReturnsOrdered()
{
@@ -508,6 +522,7 @@ public class PumpServiceTest
/// Verifies that InsertPumpObservation persists the observation and upserts the corresponding
/// pump state when no existing state is found for the device and there are no active subscribers.
/// </summary>
/// <!-- aidoc:v1 sig=98c89e1 body=3e74c5d -->
[Test]
public async Task InsertPumpObservation_Inserts_AndBroadcasts()
{