Class PumpServiceTest
[TestFixture]
public class PumpServiceTest
- Inheritance
-
PumpServiceTest
- Inherited Members
- Extension Methods
Methods
ArchiveByPatientId_InsertsArchive_ThenDeletes()
Verifies that ArchiveByPatientId inserts the patient's pump observations into the archive
repository and then deletes them, along with their related alarm events and alarm states.
[Test]
public Task ArchiveByPatientId_InsertsArchive_ThenDeletes()
Returns
FindLastPumpObservations_ReturnsOrdered()
Verifies that FindLastPumpObservations returns pump observations ordered with the most recent first,
returning only the specified number of latest entries when the repository provides multiple observations.
[Test]
public Task FindLastPumpObservations_ReturnsOrdered()
Returns
GetPaginatedPump_ByPatient_Works()
Verifies that GetPaginatedPump returns the correct paginated results when filtering by patient identifier.
Ensures the first page contains the most recent observation within the configured time tolerance.
[Test]
public Task GetPaginatedPump_ByPatient_Works()
Returns
InsertPumpObservation_Inserts_AndBroadcasts()
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.
[Test]
public Task InsertPumpObservation_Inserts_AndBroadcasts()
Returns
ProcessAlarm_End_RemovesAlarmState()
Verifies that processing a pump observation with EventPhase.End removes the corresponding alarm state
by calling RemoveAsync on the alarm state repository with the matching device, alarm type, and MDC code.
[Test]
public Task ProcessAlarm_End_RemovesAlarmState()
Returns
SaveRequest_Converts_SingleObservation_ToList()
Verifies that SaveRequest converts a single PumpObservation on an incoming
ApiRequest into a list with one entry on the request after processing.
[Test]
public Task SaveRequest_Converts_SingleObservation_ToList()
Returns
SaveRequest_CreatesPumpState_IfNotExists()
Verifies that SaveRequest creates and upserts a new PumpState
for the device when no existing pump state is found in the repository.
[Test]
public Task SaveRequest_CreatesPumpState_IfNotExists()
Returns
SaveRequest_NoSubscribers_NoBroadcast()
Verifies that SaveRequest does not broadcast a message via the client when there are no active subscribers.
[Test]
public Task SaveRequest_NoSubscribers_NoBroadcast()
Returns
- Task
A task that completes when the assertion has been executed.
SaveRequest_ORU_R40_CreatesAlarmEvent()
Verifies that saving a request of type "ORU_R40" creates a PumpAlarmEvent and does not create a PumpObservation, ensuring alarm-phase events are routed to the alarm event store rather than the observation store.
[Test]
public Task SaveRequest_ORU_R40_CreatesAlarmEvent()
Returns
SaveRequest_Retention_DeleteOlderDays_CallsRepo()
Verifies that SaveRequest invokes the observation repository's
DeleteOlderThanDaysAsync method with the configured retention value when the
retention policy returned for the pump observation is DeleteOlderDays.
[Test]
public Task SaveRequest_Retention_DeleteOlderDays_CallsRepo()
Returns
SaveRequest_Returns_When_No_Observations()
Verifies that ApiRequest processing does not insert any PumpObservation records when the request is saved without associated observations.
[Test]
public Task SaveRequest_Returns_When_No_Observations()
Returns
SaveRequest_SetsExpires_BeforeInsert()
Verifies that Service.SaveRequest sets the Expires property of the PumpObservation before persisting it via the repository.
[Test]
public Task SaveRequest_SetsExpires_BeforeInsert()
Returns
SaveRequest_UnknownType_DoesNotInsert()
Verifies that SaveRequest does not insert a PumpObservation when the Type is an unrecognized value.
[Test]
public Task SaveRequest_UnknownType_DoesNotInsert()
Returns
SaveRequest_WithSubscribers_UsesReqLocation_AndSendsBroadcast()
[Test]
public Task SaveRequest_WithSubscribers_UsesReqLocation_AndSendsBroadcast()
Returns
Setup()
Initializes the unit test fixture by creating mock repositories, services, and a mocked HttpContext with a test claims principal, then instantiates the PumpService under test using the configured API settings (5-second pump expiration, zero pump messages disabled). Pass-through mappings are configured for ICalculatedObservationsService, IConfigPumpsService, and IConfigUnitsService so that supplied pump observations are returned unchanged.
[SetUp]
public void Setup()
UpdateManyObjectId_UpdatesObs_Alarms_States()
Verifies that UpdateManyObjectId correctly updates the patient identifier across observations, alarms, and alarm state repositories.
[Test]
public Task UpdateManyObjectId_UpdatesObs_Alarms_States()
Returns
- Task
A task representing the asynchronous test execution.