=== 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:
@@ -34,6 +34,8 @@ public class CalculatedObservationsTest
|
||||
/// is produced for each test.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=3c4f27b -->
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_summary
|
||||
/// "Summary enumerates configured IOptions settings but omits IntravenousLinesCode (intravenous lines codes), which is also assigned in the setup." -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -610,6 +612,8 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that when a previous <see cref="PatientObservation"/> for the same patient and location has already been removed, the intravenous calculation performed by <see cref="CalculatedObservations.Map"/> produces a result of 0.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ca5324a body=aae89b4 -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The documentation claims a previous observation 'has already been removed', but the mocked existing observation returned by FindLastObservations has no RemoveTime set (only Action='Insert', Duration, InsertTime, Type, and Location are populated), indicating it has not been removed." -->
|
||||
[Test]
|
||||
public async Task Calculate_Intravenous_Obs_Already_Exist_Removed_Should_Return_0()
|
||||
{
|
||||
@@ -837,6 +841,8 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that mapping a new <see cref="PatientObservation"/> with a "Catéter línea media" type, when two prior intravenous lines exist (one "Catéter EPICUTÁNEO PERIFÉRICO" and one "Catéter Venoso PERIFÉRICO"), inserts an <see cref="PatientObservation"/> named "IntravenousLines" with a summed value of 5 for the given <paramref name="patientId"/>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1e74e0a body=1cc02b8 -->
|
||||
/// <!-- aidoc-review:v1 severity=low kind=extra_param
|
||||
/// "<paramref name=\"patientId\"/> refers to a local variable; the method has no parameters" -->
|
||||
[Test]
|
||||
public async Task Calculate_Intravenous_sum_one_middle_line_and_two_Peripheral_should_return_5()
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Initializes mocked dependencies and configures the dependency injection container required to instantiate the <see cref="CalculatedObservations"/> service under test.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=d74ae8f -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -114,6 +115,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that a PatientObservation with the ventilation mode "PRVC" is mapped to a calculated observation with the value "VCRP".
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=eb9f8ec body=e44fb52 -->
|
||||
[Test]
|
||||
public async Task Calculate_Ventilation_Mode_PRVC_Returns_VCRP()
|
||||
{
|
||||
@@ -137,6 +139,7 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that the calculated observations mapping translates the ventilation mode value "FLUJ.ALTO" (High Flow) into the respiratory support code "OAF".
|
||||
/// Ensures that a patient observation with the name "Resp_Mode" and value "FLUJ.ALTO" produces a non-null mapped result with the expected output value.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=76d5e48 body=d17dc11 -->
|
||||
[Test]
|
||||
public async Task Calculate_Ventilation_Mode_FLUJ_ALTO_Returns_OAF()
|
||||
{
|
||||
@@ -159,6 +162,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that when a patient observation's respiratory mode is neither "PRVC" nor "FLUJ_ALTO" (for example, "VNI PC"), the calculated observation is not mapped to "VCRP" or "OAF".
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=44eb476 body=279d733 -->
|
||||
[Test]
|
||||
public async Task Calculate_Ventilation_Mode_Not_PRVC_Not_FLUJ_ALTO_Returns_Other()
|
||||
{
|
||||
@@ -188,6 +192,7 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that the calculated observations mapping does not produce a Sattc_FiO2 observation
|
||||
/// when the Sattc value is 98, ensuring the calculation is suppressed for this specific input case.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=c417ee7 body=b77cd07 -->
|
||||
[Test]
|
||||
public async Task CalculateSF_Sattc_98_Returns_Not_Sattc_FiO2()
|
||||
{
|
||||
@@ -239,6 +244,7 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that when an FiO2 observation is processed, the Oxygenation Index is calculated and inserted
|
||||
/// using the related P_VAM and PaO2_Tidal observations retrieved for the same patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=3315812 body=f686108 -->
|
||||
[Test]
|
||||
public async Task CalculateOxygenationIndex_FiO2_Returns_Oxygenation_Index()
|
||||
{
|
||||
@@ -297,6 +303,7 @@ public class CalculatedObservationsTest
|
||||
/// (computed as <c>P_VAM × FiO2 × 100 / PaO2</c>) that is inserted through the observation service for the same patient.
|
||||
/// </summary>
|
||||
/// <returns>A task that completes when the expected <c>Oxygenation_Index</c> observation has been inserted via the mocked observation service.</returns>
|
||||
/// <!-- aidoc:v1 sig=da07bc9 body=502f5d7 -->
|
||||
[Test]
|
||||
public async Task CalculateOxygenationIndex_P_VAM_Returns_Oxygenation_Index()
|
||||
{
|
||||
@@ -353,6 +360,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that when a PaO2_Tidal observation is mapped, the calculated Oxygenation_Index is derived using the formula P_VAM * FiO2 * 100 / PaO2_Tidal and persisted as an ADAS-coded observation for the same patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d5e69ac body=9ff274d -->
|
||||
[Test]
|
||||
public async Task CalculateOxygenationIndex_PaO2_Tidal_Returns_Oxygenation_Index()
|
||||
{
|
||||
@@ -411,6 +419,8 @@ public class CalculatedObservationsTest
|
||||
/// is missing from the patient's most recent observations, even when a PaO2_Tidal observation is provided.
|
||||
/// Ensures that the mapping logic does not insert a new Oxygenation_Index observation in this scenario.
|
||||
/// </summary>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The doc states FiO2 is missing from recent observations, but the code mocks FindLastObservations to return FiO2 (it is present); PaO2_Tidal is the observation missing from the recent observations." -->
|
||||
[Test]
|
||||
public async Task CalculateOxygenationIndex_PaO2_Tidal_Not_Returns_Oxygenation_Index()
|
||||
{
|
||||
@@ -456,6 +466,7 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that the Oxygenation_Index is not calculated or persisted when the PaO2_Tidal observation value is zero.
|
||||
/// Ensures that the mapping logic skips downstream calculation and InsertObservation is never invoked in this edge case.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b4705b3 body=72f7967 -->
|
||||
[Test]
|
||||
public async Task CalculateOxygenationIndex_PaO2_Tidal_0_Not_Returns_Oxygenation_Index()
|
||||
{
|
||||
@@ -513,6 +524,7 @@ public class CalculatedObservationsTest
|
||||
/// by dividing the PaO2 value by the most recent FiO2 observation for the patient and inserting the result as a new
|
||||
/// PatientObservation with the ADAS coding system.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=087da9c body=91ce4a0 -->
|
||||
[Test]
|
||||
public async Task CalculatePF_PaO2_Returns_PaO2_FiO2()
|
||||
{
|
||||
@@ -566,6 +578,7 @@ public class CalculatedObservationsTest
|
||||
/// when an FiO2 observation is processed, by inserting a new patient observation with the
|
||||
/// expected ratio value and coding system.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=83f8636 body=46adcbd -->
|
||||
[Test]
|
||||
public async Task CalculatePF_FiO2_Returns_PaO2_FiO2()
|
||||
{
|
||||
@@ -616,6 +629,7 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that the PF ratio calculation does not produce a PaO2/FiO2 observation when the FiO2 value is zero.
|
||||
/// Ensures that no calculated observation is inserted for the patient under this condition.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=74e2fba body=e97f55c -->
|
||||
[Test]
|
||||
public async Task CalculatePF_FiO2_0_Not_Returns_PaO2_FiO2()
|
||||
{
|
||||
@@ -661,6 +675,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that when patient observations include a low SpO2 (Sattc) value of 50 and a low FC value of 50, the calculated observations processing triggers a BlueCode alarm by inserting the observation and sending the alarm.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=cb9af03 body=d68c56c -->
|
||||
[Test]
|
||||
public async Task
|
||||
SendAlarm_BlueCode_FC_SpO2_Alarm_True_Returns_SendAlarm_BlueCode()
|
||||
@@ -707,6 +722,7 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that when a BlueCode alarm condition is triggered by FC and TAm observations, the calculated blue code list is generated, the observation is inserted, and the blue code alarm is sent with the expected severity and type.
|
||||
/// </summary>
|
||||
/// <returns>A task that completes when the blue code alarm verification has been executed.</returns>
|
||||
/// <!-- aidoc:v1 sig=8d996ea body=861269c -->
|
||||
[Test]
|
||||
public async Task
|
||||
SendAlarm_BlueCode_FC_TAm_Alarm_True_Returns_SendAlarm_BlueCode()
|
||||
@@ -769,6 +785,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that a BlueCode alarm is not triggered when the heart rate (FC) is at 50 and the mean arterial pressure (TAm) values do not meet the BlueCode criteria.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=593d4af body=9dce27f -->
|
||||
[Test]
|
||||
public async Task SendAlarm_BlueCode_FC_TAm_Alarm_False()
|
||||
{
|
||||
@@ -833,6 +850,7 @@ public class CalculatedObservationsTest
|
||||
/// </summary>
|
||||
/// <param name="value">The object whose string representation will be converted to a double.</param>
|
||||
/// <returns>The parsed <see cref="double"/> value if the conversion succeeds; otherwise, <see langword="null"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=a1cea6b body=2180954 -->
|
||||
private static double? TryparseDouble(object value)
|
||||
{
|
||||
return double.TryParse(value.ToString(), out var valueParsed) ? valueParsed : null;
|
||||
@@ -951,6 +969,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that a <see cref="PatientObservation"/> representing a pump volumetric air occlusion alarm is correctly mapped by the calculated observations mapper, returning a non-null result with a matching name.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=6fdcb6b body=3319cdd -->
|
||||
[Test]
|
||||
public async Task Map_PatientObservation_Alarm_Pump_Retur_obs()
|
||||
{
|
||||
|
||||
@@ -1137,6 +1137,8 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that <see cref="_calculatedObservations"/>.<see cref="ICalculatedObservations.Map(PatientObservation, bool)"/> correctly computes the diuresis-to-weight ratio as 43.6 when the latest diuresis observation value is 3924 and the current weight observation value is 90, and persists a derived <see cref="PatientObservation"/> named "Diuresis_Weight" for the same <paramref name="patientId"/>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b46e7fe body=50dd2ac -->
|
||||
/// <!-- aidoc-review:v1 severity=low kind=extra_param
|
||||
/// "<paramref name=\"patientId\"/> references a local variable, not a method parameter; the test method has no parameters." -->
|
||||
[Test]
|
||||
public async Task CalculateDiuresis_Weight_D_3924_Receive_W_90_Return_43_6()
|
||||
{
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace adas_core.Test.Customizations.HUVH.UCIA;
|
||||
/// Marked with <c>TestFixture</c> and assigned <c>Order(2)</c> to control its execution sequence relative to other fixtures.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=d5b9e22 -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary is self-referential and circular: it claims the fixture 'validates the behavior of CalculatedObservationsTest related functionality,' but a test fixture does not validate its own behavior. The class likely tests `CalculatedObservations` functionality, not itself." -->
|
||||
[TestFixture]
|
||||
[Order(2)]
|
||||
public class CalculatedObservationsTest
|
||||
@@ -29,6 +31,7 @@ public class CalculatedObservationsTest
|
||||
/// configuring a service provider with these dependencies, and instantiating the <see cref="CalculatedObservations"/>
|
||||
/// class under test.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=20f8ac4 -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -84,6 +87,7 @@ public class CalculatedObservationsTest
|
||||
/// a RASS observation with a sufficiently low score, recent PSI and TS observations, and an active treatment
|
||||
/// (e.g., Propofol) with a minimum requested give amount that triggers the over-sedation condition.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d154c42 body=997a001 -->
|
||||
[Test]
|
||||
public async Task CalculateOverSedation_Should_Insert_Observation_When_Conditions_Met()
|
||||
{
|
||||
@@ -108,6 +112,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that no over-sedation observation is inserted when the patient's RASS score is not -4 or -5, ensuring the over-sedation calculation only applies for those specific values.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=be8cf87 body=bfc74a1 -->
|
||||
[Test]
|
||||
public async Task CalculateOverSedation_Should_Not_Insert_Observation_When_RASS_Is_Not_Negative4_Or_Negative5()
|
||||
{
|
||||
@@ -123,6 +128,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that no observation is inserted when calculating over-sedation and the patient's PSI (Sedation Intensity Index) is 25 or higher, which indicates the threshold above which the over-sedation mapping should not produce an observation.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=4c7f3e9 body=e6d4e04 -->
|
||||
[Test]
|
||||
public async Task CalculateOverSedation_Should_Not_Insert_Observation_When_PSI_Is_25_Or_Higher()
|
||||
{
|
||||
@@ -144,6 +150,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that the over-sedation calculation does not insert an observation when the patient's TS (Tidal Spontaneous) value is 5 or lower, even with a low RASS score and an elevated PSI value.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ddfbeb2 body=05fcbdd -->
|
||||
[Test]
|
||||
public async Task CalculateOverSedation_Should_Not_Insert_Observation_When_TS_Is_5_Or_Lower()
|
||||
{
|
||||
@@ -165,6 +172,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that no observation is inserted when the patient has no active treatments that exceed the configured threshold during the over-sedation calculation.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=6d6504a body=40c020e -->
|
||||
[Test]
|
||||
public async Task CalculateOverSedation_Should_Not_Insert_Observation_When_No_Treatments_Exceed_Threshold()
|
||||
{
|
||||
@@ -190,6 +198,7 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that an over-sedation observation is inserted when the calculation is triggered by a PSI observation
|
||||
/// and the patient's last RASS and TS observations, combined with active treatment data, meet the triggering criteria.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2484ab7 body=6ae0e08 -->
|
||||
[Test]
|
||||
public async Task CalculateOverSedation_Should_Insert_Observation_When_Triggered_By_PSI_Observation()
|
||||
{
|
||||
@@ -215,6 +224,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that the over-sedation calculation logic inserts a new observation when a triggering TS (Twitch Score) observation is received, given the presence of related RASS and PSI observations and an active treatment (e.g., Propofol) meeting the required minimum amount threshold.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=169c7e7 body=b584f23 -->
|
||||
[Test]
|
||||
public async Task CalculateOverSedation_Should_Insert_Observation_When_Triggered_By_TS_Observation()
|
||||
{
|
||||
@@ -246,6 +256,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that when an Inspiratory Pressure (PI) observation is processed and no Compliancia (COMPL) observation is found for the patient, the ventilation mode is set to "VMNI".
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=cdcef7f body=1f1d9d7 -->
|
||||
[Test]
|
||||
public async Task CalculateVentilationMode_Should_Set_VMNI_When_PI_PS_Arrives_Without_COMPL()
|
||||
{
|
||||
@@ -266,6 +277,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that when a "Compliancia" (COMPL) observation is mapped, the ventilation mode is calculated and set to "VMI".
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=76c6409 body=09b9d41 -->
|
||||
[Test]
|
||||
public async Task CalculateVentilationMode_Should_Set_VMI_When_COMPL_Arrives()
|
||||
{
|
||||
@@ -282,6 +294,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that when an Air Flow observation is processed and a CCC Ventilation Mode observation exists for the patient, the calculated ventilation mode is set to the value retrieved from the CCC source (e.g., "CNAF") and persisted via an insert call.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=396d8de body=c8db6fd -->
|
||||
[Test]
|
||||
public async Task CalculateVentilationMode_Should_Set_CCC_Mode_When_AirFlow_Arrives_And_CCC_Has_Mode()
|
||||
{
|
||||
@@ -344,6 +357,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that when a PI observation is processed and a COMPL observation already exists for the patient, no new calculated observation is inserted.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a3a2ffc body=3e27399 -->
|
||||
[Test]
|
||||
public async Task CalculateVentilationMode_Should_Not_Insert_When_PI_Arrives_And_COMPL_Already_Exists()
|
||||
{
|
||||
@@ -363,6 +377,7 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that no calculated observation is inserted when a PS (Pressure Support) observation is processed
|
||||
/// and a COMPL observation already exists for the patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f7af740 body=6680e7c -->
|
||||
[Test]
|
||||
public async Task CalculateVentilationMode_Should_Not_Insert_When_PS_Arrives_And_COMPL_Already_Exists()
|
||||
{
|
||||
@@ -386,6 +401,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that mapping a <see cref="PatientObservation"/> with Name "ECMO_Location" and Value "VV" returns a non-null result whose value is "VV".
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=c8afb0f body=7f629ed -->
|
||||
[Test]
|
||||
public async Task CalculateEcmoLocation_Should_Return_VV_When_Value_Is_VV()
|
||||
{
|
||||
@@ -398,6 +414,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that the ECMO location calculation returns "VA" when the input observation value is "VA".
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=c311f8b body=5b8882f -->
|
||||
[Test]
|
||||
public async Task CalculateEcmoLocation_Should_Return_VA_When_Value_Is_VA()
|
||||
{
|
||||
@@ -412,6 +429,7 @@ public class CalculatedObservationsTest
|
||||
/// (e.g., "ECCO2r", "VVDL", "VA+V", "VVDL+V", "VV+V", "VVA").
|
||||
/// </summary>
|
||||
/// <param name="inputValue">The ECMO location code assigned to the <see cref="PatientObservation"/> value under test.</param>
|
||||
/// <!-- aidoc:v1 sig=90b3dc0 body=064eda8 -->
|
||||
[Test]
|
||||
[TestCase("ECCO2r")]
|
||||
[TestCase("VVDL")]
|
||||
@@ -430,6 +448,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that the ECMO Location mapping does not alter the observation value when the provided value is not present in the recognized ECMO list, leaving the original value unchanged.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=bfe3e66 body=de3ceb3 -->
|
||||
[Test]
|
||||
public async Task CalculateEcmoLocation_Should_Not_Change_Value_When_Not_In_Ecmo_List()
|
||||
{
|
||||
@@ -443,6 +462,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that the mapping of a <see cref="PatientObservation"/> through the calculated observations mapper returns the original observation unchanged, ensuring the mapping is a no-op for patient observations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=cd439fd body=1a3d8c5 -->
|
||||
[Test]
|
||||
public async Task CalculateEcmoLocation_Should_Return_Original_Observation_When_Not_PatientObservation()
|
||||
{
|
||||
@@ -460,6 +480,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that an "Over_Analgesia" observation with value "True" is created when the patient has active analgesic treatments (Morfina, Remifentanilo) and the last ANI observation indicates a high value (80), suggesting over-analgesia.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=0e024bd body=5783315 -->
|
||||
[Test]
|
||||
public async Task CalculateOverAnalgesia_Should_Create_Observation_When_Conditions_Are_Met()
|
||||
{
|
||||
@@ -534,6 +555,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that the mapping correctly calculates and inserts the driving pressure (Pmeset minus PEEP) when both source observations are available.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=52ff2df body=3ae93a9 -->
|
||||
[Test]
|
||||
public async Task CalculateDrivingPressure_Should_Calculate_Correctly_When_Both_Observations_Are_Present()
|
||||
{
|
||||
@@ -594,6 +616,7 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that the Rox Index is calculated correctly by dividing the SpO2/FiO2 ratio by the respiratory rate (FR)
|
||||
/// when both required observations are available, and that the result is persisted as a new "Rox_Index" observation.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=3c50640 body=5d52d72 -->
|
||||
[Test]
|
||||
public async Task CalculateRoxIndex_Should_Calculate_Correctly_When_Both_Observations_Are_Present()
|
||||
{
|
||||
@@ -654,6 +677,7 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that the ROX index calculation is not performed when the respiratory rate (FR) is zero,
|
||||
/// preventing a division by zero error.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=30bf581 body=30b6497 -->
|
||||
[Test]
|
||||
public async Task CalculateRoxIndex_Should_Not_Calculate_When_FR_Is_Zero_To_Avoid_Division_By_Zero()
|
||||
{
|
||||
@@ -682,6 +706,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that the diuresis calculation produces the correct value when prior diuresis observations and a weight observation are available for the patient, resulting in a new "Calculated_Diuresis" observation being inserted.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=e5bb5b0 body=2792c9b -->
|
||||
[Test]
|
||||
public async Task CalculateDiuresis_Should_Calculate_Correctly_When_Observations_Are_Available()
|
||||
{
|
||||
@@ -723,6 +748,7 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that diuresis is not calculated when no diuresis observations are found for the patient.
|
||||
/// Ensures the mapping logic skips persistence of a calculated diuresis observation when required prior observations are missing.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=014e5d8 body=794ece0 -->
|
||||
[Test]
|
||||
public async Task CalculateDiuresis_Should_Not_Calculate_If_Diuresis_Observations_Are_Missing()
|
||||
{
|
||||
@@ -747,6 +773,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that the diuresis calculation is not performed when the patient has no weight observation available, ensuring no new observation is inserted.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=c3e7f69 body=c70ddf8 -->
|
||||
[Test]
|
||||
public async Task CalculateDiuresis_Should_Not_Calculate_If_Weight_Is_Invalid()
|
||||
{
|
||||
@@ -778,6 +805,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that the rehabilitation observation mapping sets the status to Alert when the recent rehabilitation values meet the alert condition.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b72fc81 body=739bfe1 -->
|
||||
[Test]
|
||||
public async Task CalculateRehabilitationAlarm_Should_Set_Alert_When_Condition_Is_Met()
|
||||
{
|
||||
@@ -809,6 +837,7 @@ public class CalculatedObservationsTest
|
||||
/// configured condition is not met, even when the most recent observation values are within an
|
||||
/// expected range and an out-of-range value is present among the evaluated history.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f5d4651 body=851916f -->
|
||||
[Test]
|
||||
public async Task CalculateRehabilitationAlarm_Should_Not_Set_Alert_When_Condition_Is_Not_Met()
|
||||
{
|
||||
@@ -838,6 +867,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that the <c>Map</c> method does not set an alert for a Rehabilitation observation when its value is greater than 2, returning the original observation unchanged.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=4222131 body=b1c7f39 -->
|
||||
[Test]
|
||||
public async Task CalculateRehabilitationAlarm_Should_Not_Set_Alert_When_Value_Is_Greater_Than_2()
|
||||
{
|
||||
@@ -856,6 +886,7 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that the rehabilitation alarm calculation returns the same observation unchanged when the input observation is not a <see cref="PatientObservation"/>.
|
||||
/// This ensures that the mapping method does not perform any transformation for non-patient observations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b686378 body=10526fb -->
|
||||
[Test]
|
||||
public async Task CalculateRehabilitationAlarm_Should_Return_Same_Observation_If_Not_PatientObservation()
|
||||
{
|
||||
|
||||
@@ -1404,6 +1404,7 @@ public class CalculatedObservationsTest
|
||||
/// the Map method creates and inserts a multivalue observation (Respiratory_Device_Multivalue)
|
||||
/// containing the intervention description extracted from the observation value.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=163c94e body=65cb819 -->
|
||||
[Test]
|
||||
public async Task Map_WithInterventionCodeInObservationValue_CallsCalculateInterventionMultiValueObservation()
|
||||
{
|
||||
@@ -1437,6 +1438,7 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that mapping an <c>Intervention_Out</c> observation updates an existing active multi-value observation
|
||||
/// (e.g., <c>Respiratory_Device_Multivalue</c>) for the patient by setting its end time, rather than inserting a new observation.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d1e8de8 body=707d6a7 -->
|
||||
[Test]
|
||||
public async Task Map_WithInterventionOut_UpdatesExistingMultiValueObservation()
|
||||
{
|
||||
@@ -1483,6 +1485,10 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that when a new "Intervention_In" observation is mapped via <c>Map</c> and the patient's prior "Respiratory_Device_Multivalue" observation is expired (so there is no existing active last observation), a new <see cref="PatientObservation"/> named "Respiratory_Device_Multivalue" is inserted containing the new intervention while the existing expired observation is left untouched.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=4271f27 body=7d4a79d -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary states the newly inserted observation is 'containing the new intervention', but the assertion explicitly checks that the inserted value is NOT equal to the new intervention description (`((string[])o.Value)[0] != newInterventionDescription`). The test allows a value that is neither the old nor the new intervention, contradicting the documented behavior." -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary claims 'the existing expired observation is left untouched', but the test only verifies that UpdateObservation is never called; there is no assertion specifically confirming the expired observation is untouched (e.g., it could still be replaced or modified via a path the mocks don't cover)." -->
|
||||
[Test]
|
||||
public async Task Map_WithNewInterventionNoExistingLastIntervention_NewMultiValueObservation()
|
||||
{
|
||||
@@ -1541,6 +1547,8 @@ public class CalculatedObservationsTest
|
||||
/// new record through <see cref="IObservationService.InsertObservation"/>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=4e3257d body=697676f -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary states 'the new intervention is appended to the existing multi-value observation via UpdateObservation', but the UpdateObservation assertion verifies the updated observation has Length == 1 with only the existing intervention (and Expired = true), NOT the new intervention appended. The assertions verify the existing observation is expired via UpdateObservation and that no combined InsertObservation occurs, contradicting the described append-via-UpdateObservation behavior." -->
|
||||
[Test]
|
||||
public async Task Map_WithNewInterventionAddsToExistingMultiValueObservation()
|
||||
{
|
||||
@@ -1602,6 +1610,7 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that mapping a surgery observation inserts a new Surgery_Multivalue observation
|
||||
/// when no existing multi-value observation is found, and does not trigger an update.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a509623 body=817f4ef -->
|
||||
[Test]
|
||||
public async Task Map_WithSurgeryObservation_InsertsNewSurgeryMultiValueObservation()
|
||||
{
|
||||
@@ -1645,6 +1654,7 @@ public class CalculatedObservationsTest
|
||||
/// to be expired and replaced with a new multi-value observation that contains both the previously recorded
|
||||
/// surgery value and the newly mapped surgery value.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d2c7ca7 body=551d45d -->
|
||||
[Test]
|
||||
public async Task Map_WithSurgeryObservation_UpdatesExistingSurgeryMultiValueObservation()
|
||||
{
|
||||
@@ -1700,6 +1710,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that mapping a Surgery observation updates the existing Surgery_Multivalue observation by expiring the duplicate entry and inserting a new observation with the duplicate value removed.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=46caac9 body=55e3f72 -->
|
||||
[Test]
|
||||
public async Task Map_WithSurgeryObservation_UpdatesExistingSurgeryMultiValueObservation_RemovesDuplicate()
|
||||
{
|
||||
@@ -1754,6 +1765,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that does not insert or update any observation when a surgery observation is provided with a non-string <c>Value</c>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=e4795ba body=7bfc460 -->
|
||||
[Test]
|
||||
public async Task Map_WithSurgeryObservation_HandlesNonStringValue()
|
||||
{
|
||||
@@ -1782,6 +1794,7 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that the <see cref="CalculatedObservations.Map"/> method, when invoked with a respiratory device multivalue observation
|
||||
/// and no prior observations, inserts a "Complexity" observation with a value of 1.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=09fcb0a body=445a173 -->
|
||||
[Test]
|
||||
public async Task Map_WithRespiratoryDeviceMultiValueObservation_CallsCalculateComplexity_Return1()
|
||||
{
|
||||
@@ -1887,6 +1900,8 @@ public class CalculatedObservationsTest
|
||||
/// </summary>
|
||||
/// <param name="observation">The <see cref="PatientObservation"/> instance passed implicitly to the
|
||||
/// test runner; not directly used as a method argument since this is a parameterless test method.</param>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=extra_param
|
||||
/// "The test method has no parameters, but the documentation includes a <param name=\"observation\"> tag. While the text acknowledges it is parameterless, the tag itself should not exist." -->
|
||||
[Test]
|
||||
public async Task Map_WithTwoMedicationMultiValueObservation_CalculatesComplexity_Return4()
|
||||
{
|
||||
@@ -1928,6 +1943,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that when a patient has a system multivalue observation, medication multivalue observations, and a newborn weight observation, the mapping process calculates a complexity value of 9 and inserts it as a new "Complexity" observation.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=fdea61e body=5aa8c09 -->
|
||||
[Test]
|
||||
public async Task Map_WithSystemMedicationAndNewbornWeightMultiValueObservation_CalculatesComplexity_Return9()
|
||||
{
|
||||
@@ -2025,6 +2041,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that the <c>Map</c> method correctly calculates a complexity value of 13 when the input observation represents surgery, medication, and newborn weight data, by aggregating the per-section contribution of each observation type.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=9b92aff body=952f1bc -->
|
||||
[Test]
|
||||
public async Task Map_WithSurgeryMedicationMewbornWeightMultiValueObservation_CalculatesComplexity_Returns13()
|
||||
{
|
||||
@@ -2356,6 +2373,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that mapping a patient treatment with no placer order returns the original treatment unchanged.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=4641a92 body=97aa6f6 -->
|
||||
[Test]
|
||||
public async Task Map_TreatmentWithNoPlacerOrder_ReturnsOriginalTreatment()
|
||||
{
|
||||
@@ -2374,6 +2392,7 @@ public class CalculatedObservationsTest
|
||||
/// Verifies that mapping a treatment which has active older treatments sets the order control to <c>XO</c>
|
||||
/// (cancel as a result of a new order being accepted) and does not insert a new observation.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=3fa3c83 body=55a8c26 -->
|
||||
[Test]
|
||||
public async Task Map_TreatmentWithActiveOlderTreatments_SetsOrderControlToXO()
|
||||
{
|
||||
@@ -2399,6 +2418,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that when mapping a patient treatment with no active older treatments, the resulting order control is set to <see cref="OrderControlType.Nw"/> and no patient observation is inserted.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a3a0846 body=9a069fa -->
|
||||
[Test]
|
||||
public async Task Map_TreatmentWithNoActiveOlderTreatments_SetsOrderControlToNW()
|
||||
{
|
||||
@@ -2423,6 +2443,7 @@ public class CalculatedObservationsTest
|
||||
/// <summary>
|
||||
/// Verifies that when a patient treatment has an end time set, mapping it sets the order control to <see cref="OrderControlType.Dc"/> and does not insert a new observation.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=c977810 body=b9cabf5 -->
|
||||
[Test]
|
||||
public async Task Map_TreatmentWithEndTimeSet_SetsOrderControlToDC()
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace adas_core.Test.Models;
|
||||
/// <summary>
|
||||
/// Represents a fake implementation of the ILogger interface, typically used as a test double to simulate logging behavior.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=274aadb -->
|
||||
public class FakeLogger : ILogger
|
||||
{
|
||||
public List<string> Messages { get; } = [];
|
||||
@@ -16,6 +17,7 @@ public class FakeLogger : ILogger
|
||||
/// </summary>
|
||||
/// <param name="enrichers">The collection of enrichers intended to add contextual properties to log events.</param>
|
||||
/// <returns>The current <see cref="ILogger"/> instance, without the supplied enrichers applied.</returns>
|
||||
/// <!-- aidoc:v1 sig=2988ec2 body=62e89c5 -->
|
||||
public ILogger ForContext(IEnumerable<ILogEventEnricher> enrichers)
|
||||
{
|
||||
return this;
|
||||
@@ -28,6 +30,8 @@ public class FakeLogger : ILogger
|
||||
/// <param name="value">The value associated with the property. Can be null.</param>
|
||||
/// <param name="destructureObjects">Indicates whether complex objects should be destructured. Defaults to false.</param>
|
||||
/// <returns>The current <see cref="ILogger"/> instance.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary states the method 'Creates a logger context enriched with the specified property and value', but the implementation simply returns `this` without doing any enrichment or context creation. The `propertyName`, `value`, and `destructureObjects` parameters are completely ignored." -->
|
||||
public ILogger ForContext(string propertyName, object? value, bool destructureObjects = false)
|
||||
{
|
||||
return this;
|
||||
@@ -38,6 +42,7 @@ public class FakeLogger : ILogger
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource">The source type used to enrich the logger context.</typeparam>
|
||||
/// <returns>The current <see cref="ILogger"/> instance.</returns>
|
||||
/// <!-- aidoc:v1 sig=11a41bb body=62e89c5 -->
|
||||
public ILogger ForContext<TSource>()
|
||||
{
|
||||
return this;
|
||||
@@ -48,6 +53,7 @@ public class FakeLogger : ILogger
|
||||
/// </summary>
|
||||
/// <param name="source">The source type used to enrich the logger context.</param>
|
||||
/// <returns>The current <see cref="ILogger"/> instance.</returns>
|
||||
/// <!-- aidoc:v1 sig=b6256d2 body=62e89c5 -->
|
||||
public ILogger ForContext(Type source)
|
||||
{
|
||||
return this;
|
||||
@@ -57,6 +63,7 @@ public class FakeLogger : ILogger
|
||||
/// Appends the rendered message of the provided log event to the internal messages collection.
|
||||
/// </summary>
|
||||
/// <param name="logEvent">The log event whose rendered message will be added to the collection.</param>
|
||||
/// <!-- aidoc:v1 sig=e35d092 body=03b8903 -->
|
||||
public void Write(LogEvent logEvent)
|
||||
{
|
||||
Messages.Add(logEvent.RenderMessage());
|
||||
@@ -68,6 +75,7 @@ public class FakeLogger : ILogger
|
||||
/// <param name="level">The severity level of the log event.</param>
|
||||
/// <param name="messageTemplate">The message template containing placeholders for the property values.</param>
|
||||
/// <param name="propertyValues">An optional array of objects to format the message template. Can be <see langword="null"/>.</param>
|
||||
/// <!-- aidoc:v1 sig=c2fa9db body=991505c -->
|
||||
public void Write(LogEventLevel level, string messageTemplate, params object?[]? propertyValues)
|
||||
{
|
||||
// Manejar la situación donde propertyValues es nulo, si es necesario
|
||||
@@ -84,6 +92,7 @@ public class FakeLogger : ILogger
|
||||
/// <param name="level">The log event level associated with the entry being written.</param>
|
||||
/// <param name="messageTemplate">The message template containing a format placeholder for the property value.</param>
|
||||
/// <param name="propertyValue">The value to be inserted into the message template.</param>
|
||||
/// <!-- aidoc:v1 sig=f334e80 body=d9646d0 -->
|
||||
public void Write<T>(LogEventLevel level, string messageTemplate, T propertyValue)
|
||||
{
|
||||
Messages.Add(string.Format(messageTemplate, propertyValue));
|
||||
@@ -99,6 +108,7 @@ public class FakeLogger : ILogger
|
||||
/// <param name="exception">An optional exception whose message is recorded when not null.</param>
|
||||
/// <param name="messageTemplate">The message template to log, used directly when <paramref name="propertyValues"/> is null.</param>
|
||||
/// <param name="propertyValues">Optional values to substitute into <paramref name="messageTemplate"/> via <c>string.Format</c>.</param>
|
||||
/// <!-- aidoc:v1 sig=e067f48 body=cc5019f -->
|
||||
public void Write(LogEventLevel level, Exception? exception, string messageTemplate,
|
||||
params object?[]? propertyValues)
|
||||
{
|
||||
@@ -113,6 +123,7 @@ public class FakeLogger : ILogger
|
||||
/// </summary>
|
||||
/// <param name="level">The log event level to evaluate.</param>
|
||||
/// <returns><c>true</c> if logging is enabled for the given level; otherwise, <c>false</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=2702665 body=eb3da57 -->
|
||||
public bool IsEnabled(LogEventLevel level)
|
||||
{
|
||||
return true;
|
||||
@@ -125,6 +136,7 @@ public class FakeLogger : ILogger
|
||||
/// <param name="exception">An optional exception whose message, when not null, is added to the Messages collection after the formatted message.</param>
|
||||
/// <param name="messageTemplate">The message template string used to format the log entry.</param>
|
||||
/// <param name="propertyValue">The value to be substituted into the message template.</param>
|
||||
/// <!-- aidoc:v1 sig=b73f265 body=2727c3a -->
|
||||
public void Write<T>(LogEventLevel level, Exception? exception, string messageTemplate, T propertyValue)
|
||||
{
|
||||
Messages.Add(string.Format(messageTemplate, propertyValue));
|
||||
|
||||
@@ -22,6 +22,7 @@ public class SubscriberGroupedTest
|
||||
/// <see cref="WsSubscriberGrouped"/> instances configured for two distinct patients with shift- and
|
||||
/// hour-based regularities and last/last-filled result mappings.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=c105125 -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -108,6 +109,7 @@ public class SubscriberGroupedTest
|
||||
/// Verifies that the <see cref="ISubscriberGroupedService.GetGrouped"/> method returns the list of grouped subscribers provided by the mocked service.
|
||||
/// Ensures the service correctly returns the expected collection of <see cref="WsSubscriberGrouped"/> items without modification.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=861df1c body=dcd5b93 -->
|
||||
[Test]
|
||||
public void GetGroupeds_ReturnsExpectedResult()
|
||||
{
|
||||
@@ -129,6 +131,7 @@ public class SubscriberGroupedTest
|
||||
/// <summary>
|
||||
/// Verifies the behavior of the <c>Compare</c> extension method by asserting that it returns <c>true</c> when the gender and patient identifiers match the active context, and <c>false</c> when they do not, covering both the primary and secondary contexts.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=56cc31f body=8311fa7 -->
|
||||
[Test]
|
||||
public void Compare_ExtensionResult()
|
||||
{
|
||||
@@ -144,6 +147,7 @@ public class SubscriberGroupedTest
|
||||
/// <summary>
|
||||
/// Verifies that a new patient observation is considered relevant for its group when it is the first observation recorded within the current hour.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a709b13 body=23c06ac -->
|
||||
[Test]
|
||||
public void Observation_is_rrelevant_because_is_the_first_in_hour()
|
||||
{
|
||||
@@ -160,6 +164,7 @@ public class SubscriberGroupedTest
|
||||
/// <summary>
|
||||
/// Verifies that a new patient observation is considered relevant for a grouped observation when an observation already exists within the configured hour interval and the grouping uses the Max result.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1d23e43 body=67f556f -->
|
||||
[Test]
|
||||
public void Grouped_Observation_Already_Observations_In_Hour_Should_Be_Relevant_By_Max_Result()
|
||||
{
|
||||
@@ -212,6 +217,7 @@ public class SubscriberGroupedTest
|
||||
/// <summary>
|
||||
/// Verifies that a new observation is considered not relevant for a grouped observation when the grouping rule is set to "Max", the regularity is "Hour", an observation already exists within the same hour, and the new observation's value does not exceed the existing maximum value.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f303af5 body=ff99dd7 -->
|
||||
[Test]
|
||||
public void Grouped_Observation_Already_Observations_In_Hour_Should_Be_IRelevant_By_Max_Result()
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@ public class AdmissionRepositoryTest
|
||||
/// Initializes the integration test environment by resetting the admissions collection
|
||||
/// and seeding it with valid admission records to be used across the test fixture.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=3f12caf -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -57,6 +58,7 @@ public class AdmissionRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="AdmissionRepository.InsertOneAsync"/> successfully persists a valid admission so that it can subsequently be retrieved by its identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=6ca2d2e body=b9057c2 -->
|
||||
[Test]
|
||||
public async Task InsertOneAsync_Success()
|
||||
{
|
||||
@@ -76,6 +78,7 @@ public class AdmissionRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository successfully deletes an admission record, ensuring that the deleted admission can no longer be retrieved by its identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=0c937b9 body=c7bb396 -->
|
||||
[Test]
|
||||
public async Task Delete_Success()
|
||||
{
|
||||
@@ -94,6 +97,7 @@ public class AdmissionRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="Admission"/> updates are persisted successfully by inserting an admission, modifying one of its fields, and asserting that the updated value is retrieved.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=cadac73 body=ac0859e -->
|
||||
[Test]
|
||||
public async Task Update_Success()
|
||||
{
|
||||
@@ -118,6 +122,7 @@ public class AdmissionRepositoryTest
|
||||
/// <c>PointOfCareId</c> of an existing admission to the specified new location identifier
|
||||
/// and that the change is persisted in the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=25ab00f body=a9cfae4 -->
|
||||
[Test]
|
||||
public async Task UpdateLocation_Success()
|
||||
{
|
||||
@@ -142,6 +147,7 @@ public class AdmissionRepositoryTest
|
||||
/// Verifies that the repository successfully updates the patient information of an existing admission,
|
||||
/// ensuring the updated admission can be retrieved and reflects the new patient's details.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=cc5dc00 body=d8a50b1 -->
|
||||
[Test]
|
||||
public async Task UpdatePatient_Success()
|
||||
{
|
||||
@@ -170,6 +176,7 @@ public class AdmissionRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's FindAll operation successfully retrieves all admissions, returning a non-empty collection of exactly three records.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=9b3759c body=0845192 -->
|
||||
[Test]
|
||||
public async Task FindAll_Success()
|
||||
{
|
||||
@@ -189,6 +196,7 @@ public class AdmissionRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository successfully retrieves an admission by its unique identifier after it has been inserted.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2d082b2 body=9d58a46 -->
|
||||
[Test]
|
||||
public async Task FindById_Success()
|
||||
{
|
||||
@@ -207,6 +215,7 @@ public class AdmissionRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>FindById</c> method returns <c>null</c> when queried with a non-existing identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=464d0a4 body=1ff6d58 -->
|
||||
[Test]
|
||||
public async Task FindById_NotFound()
|
||||
{
|
||||
@@ -224,6 +233,7 @@ public class AdmissionRepositoryTest
|
||||
/// Verifies that <see cref="AdmissionRepository.FindByNhc"/> successfully retrieves an admission record from the repository using its NHC identifier.
|
||||
/// Confirms that the returned record is not null and that the NHC of the retrieved admission matches the one used in the lookup.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=313e6e8 body=dd6590c -->
|
||||
[Test]
|
||||
public async Task FindByNhc_Success()
|
||||
{
|
||||
@@ -242,6 +252,7 @@ public class AdmissionRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="AdmissionRepository"/>.<c>FindByNhc</c> returns <c>null</c> when the provided NHC does not exist in the data source.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f2a806f body=99d3860 -->
|
||||
[Test]
|
||||
public async Task FindByNhc_NotFound()
|
||||
{
|
||||
@@ -319,6 +330,7 @@ public class AdmissionRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that inserting a valid admission through the repository returns the same admission and persists it so it can be retrieved by its identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=5e423f0 body=ff7f179 -->
|
||||
[Test]
|
||||
public async Task InsertOneAsyncAndReturn_Success()
|
||||
{
|
||||
@@ -341,6 +353,7 @@ public class AdmissionRepositoryTest
|
||||
/// Tests that the repository's <c>GetAdmissionByUnitIdWithOutPoC</c> method returns only the admissions matching the specified unit identifier
|
||||
/// while excluding admissions that have an associated point-of-care identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=5759221 body=88f5048 -->
|
||||
[Test]
|
||||
public async Task GetAdmissionByUnitIdWithOutPoC_Success()
|
||||
{
|
||||
@@ -370,6 +383,7 @@ public class AdmissionRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>GetAdmissionByUnitIdWithOutPoC</c> returns an empty result set (instead of null) when no admissions match the provided unit identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2150f4c body=a2de31a -->
|
||||
[Test]
|
||||
public async Task GetAdmissionByUnitIdWithOutPoC_NoMatch()
|
||||
{
|
||||
@@ -387,6 +401,7 @@ public class AdmissionRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>FindByPointOfCareId</c> method successfully retrieves the admission matching the specified point of care identifier, returning a single result and excluding admissions associated with different point of care identifiers.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=88efc70 body=b058bc3 -->
|
||||
[Test]
|
||||
public async Task FindByPointOfCareId_Success()
|
||||
{
|
||||
@@ -410,6 +425,7 @@ public class AdmissionRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="AdmissionRepository"/>.FindByPointOfCareId returns a non-null empty collection when no point of care matches the provided identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=10c01cc body=b5fceef -->
|
||||
[Test]
|
||||
public async Task FindByPointOfCareId_NoMatch()
|
||||
{
|
||||
@@ -424,6 +440,7 @@ public class AdmissionRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="AdmissionRepository"/>.<c>FindByDiagnosis</c> successfully returns a non-null result when retrieving admissions matching the specified diagnosis value.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=070caef body=da3bf67 -->
|
||||
[Test]
|
||||
public async Task FindByDiagnosis_Success()
|
||||
{
|
||||
@@ -445,6 +462,7 @@ public class AdmissionRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="AdmissionRepository"/>.<c>FindByDiagnosis</c> returns an empty collection when no entity matches the provided diagnosis.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2b70ce2 body=fefa57f -->
|
||||
[Test]
|
||||
public async Task FindByDiagnosis_NoMatch()
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@ public class AlarmRepositoryTest
|
||||
/// <see cref="PatientObservationAlarm"/> records by resetting the target
|
||||
/// collection and inserting the test data for use across the test fixture.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=0cc6054 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -87,6 +88,8 @@ public class AlarmRepositoryTest
|
||||
/// </summary>
|
||||
/// <param name="filter">The collection of <see cref="Field"/> objects used to filter observations; contains a single non-existent field to ensure no matches are found.</param>
|
||||
/// <returns>A task that completes after asserting the repository returns a non-null but empty result.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=extra_param
|
||||
/// "The test method has no parameters, but the documentation includes a <param name=\"filter\"> describing the local variable rather than a method parameter." -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientLastObservationsByField_Not_Found_Returns_Empty_List()
|
||||
{
|
||||
@@ -109,6 +112,7 @@ public class AlarmRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that AggregatedPatientLastObservationsByField returns exactly one aggregated result when matching last observations are found for the specified patient and field filter.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=9bbf1e0 body=05c8194 -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientLastObservationsByField_Found_Returns_1()
|
||||
{
|
||||
@@ -131,6 +135,7 @@ public class AlarmRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="AlarmRepository.AggregatedPatientLastObservationsByField"/> returns a non-null collection containing an entry for each matching field in the filter when observations are found for the given patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=7bd117f body=144c5f6 -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientLastObservationsByField_Found_Returns_2()
|
||||
{
|
||||
@@ -159,6 +164,7 @@ public class AlarmRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository returns an empty list when querying aggregated patient last observations by field with a filter that specifies OnlyExpired as true, and the matching patient observation alarm is expired.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=80c2dcc body=92a6f2f -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientLastObservationsByField_AllExpired_Returns_Empty_List()
|
||||
{
|
||||
@@ -198,6 +204,7 @@ public class AlarmRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that when multiple observations exist for the same field, the aggregation returns only the most recent observation based on the timestamp.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=36c9e3d body=9fe0818 -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientLastObservationsByField_MultipleObservations_Returns_Most_Recent()
|
||||
{
|
||||
@@ -254,6 +261,7 @@ public class AlarmRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="AlarmRepository.AggregatedPatientLastObservationsByField"/> returns all of a patient's last observations when no field filter is provided.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=621b9bb body=6fff436 -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientLastObservationsByField_FilterObservations_Null_Returns_All()
|
||||
{
|
||||
|
||||
@@ -28,6 +28,7 @@ public class AppointmentArchiveRepositoryTest
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="Task"/> that completes when the collection has been recreated and both
|
||||
/// seed appointments have been inserted.</returns>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=d044105 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -95,6 +96,7 @@ public class AppointmentArchiveRepositoryTest
|
||||
/// with a timestamp earlier than the specified cutoff date (two hours before the current time),
|
||||
/// while retaining records dated at or after the cutoff for the given patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d3a5eeb body=7124e14 -->
|
||||
[Test]
|
||||
public async Task DeleteBeforeDate()
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ public class AppointmentRepositoryTest
|
||||
/// <summary>
|
||||
/// Performs one-time setup for integration tests by resetting the patients_appointments collection and seeding it with two test patient appointments: one with minimal fields and another extended with visit number, appointment reason, and resource groups.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=af4b115 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -85,6 +86,7 @@ public class AppointmentRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="AppointmentRepository"/>.GetByPatient returns a non-null, non-empty list when a valid patient identifier is provided.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b07f445 body=1ecc19f -->
|
||||
[Test]
|
||||
public async Task GetByPatient_Find_Patient_Return_List()
|
||||
{
|
||||
@@ -97,6 +99,7 @@ public class AppointmentRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="AppointmentRepository.GetByPatient"/> returns a non-null, empty list when no records are found for the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=11046fe body=f92c1ae -->
|
||||
[Test]
|
||||
public async Task GetByPatient_not_Find_Patient_Return_Empty_List()
|
||||
{
|
||||
@@ -109,6 +112,7 @@ public class AppointmentRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository returns <c>null</c> when no patient is found matching the specified patient identifier and visit number.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a3c1464 body=169eed1 -->
|
||||
[Test]
|
||||
public async Task FindByPatientAndVisitNumber_Not_Find_Patient_Return_Null()
|
||||
{
|
||||
@@ -121,6 +125,7 @@ public class AppointmentRepositoryTest
|
||||
/// Verifies that the repository's FindByPatientAndVisitNumber method successfully retrieves
|
||||
/// the corresponding appointment when a valid patient identifier and an existing visit number are supplied.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=c9fc233 body=1b1a8ee -->
|
||||
[Test]
|
||||
public async Task FindByPatientAndVisitNumber_Find_Patient_Return_Appointment()
|
||||
{
|
||||
@@ -133,6 +138,7 @@ public class AppointmentRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository returns null when searching for an appointment by patient ID and a reason that does not match any existing appointment.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=8261277 body=aaea632 -->
|
||||
[Test]
|
||||
public async Task FindByPatientAndReason_Not_Find_Patient_Return_Null()
|
||||
{
|
||||
@@ -144,6 +150,7 @@ public class AppointmentRepositoryTest
|
||||
/// <summary>
|
||||
/// Tests that FindByPatientAndReason returns a non-null appointment containing the expected AppointmentReason for the specified patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=97cceac body=2ab244e -->
|
||||
[Test]
|
||||
public async Task FindByPatientAndReason_Find_Patient_Return_Appointment()
|
||||
{
|
||||
@@ -156,6 +163,7 @@ public class AppointmentRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="AppointmentRepository"/>.<c>FindByLocation</c> returns an empty (non-null) collection when no patient is associated with the specified location.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ca32bb9 body=fbf72c8 -->
|
||||
[Test]
|
||||
public async Task FindByLocation_Not_Find_Patient_Return_Null()
|
||||
{
|
||||
@@ -170,6 +178,7 @@ public class AppointmentRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="AppointmentRepository.FindByLocation"/> successfully retrieves the appointment associated with a patient located at the specified <see cref="PatientLocation"/>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=531bfca body=5f2109a -->
|
||||
[Test]
|
||||
public async Task FindByLocation_Find_Patient_Return_Appointment()
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@ public class ConfigObservationRepositoryTest
|
||||
/// system references, original name mappings, and observations with min/max alert thresholds
|
||||
/// and forced alert behavior.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=14402f7 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -123,6 +124,7 @@ public class ConfigObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's FindById method returns a non-null configuration result when queried with a valid id.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=90db18c body=1df1e1d -->
|
||||
[Test]
|
||||
public async Task FindById_Find_Id_Return_Configs()
|
||||
{
|
||||
@@ -134,6 +136,7 @@ public class ConfigObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the <c>FindById</c> repository method returns <c>null</c> when invoked with a newly generated, non-existing identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ec16c67 body=c6d06bf -->
|
||||
[Test]
|
||||
public async Task FindById_Not_Find_Id_Return_Empty()
|
||||
{
|
||||
@@ -145,6 +148,7 @@ public class ConfigObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that an existing <see cref="ConfigObservation"/> can be retrieved by its identifier and subsequently updated, ensuring the updated entity reflects the new values.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=920dd57 body=d0216be -->
|
||||
[Test]
|
||||
public async Task Update_Find_Id_Return_Update_Configs()
|
||||
{
|
||||
@@ -170,6 +174,7 @@ public class ConfigObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's Update operation creates a new record when the provided identifier does not exist in the data store, instead of failing.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=26cbb5c body=e514eb3 -->
|
||||
[Test]
|
||||
public async Task Update_Not_Find_Id_Create_It()
|
||||
{
|
||||
@@ -192,6 +197,7 @@ public class ConfigObservationRepositoryTest
|
||||
/// Verifies that the base delete operation removes a <see cref="ConfigObservation"/> from the repository.
|
||||
/// The test confirms the entity is absent before insertion, present after insertion, and absent again after deletion.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=59f0dda body=38d51c3 -->
|
||||
[Test]
|
||||
public async Task Delete_With_Base_DeleteAsync()
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@ public class ConfigPumpsRepositoryTest
|
||||
/// <summary>
|
||||
/// Initializes the integration test environment by recreating the config_pumps collection and inserting a single configuration pump containing two empty items for use by subsequent tests.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=6340da1 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -56,6 +57,7 @@ public class ConfigPumpsRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="ConfigPumpsRepository.FindById"/> returns a non-null result when searching by the identifier "PV1".
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=670411f body=fce7952 -->
|
||||
[Test]
|
||||
public async Task FindById_Find_id_Return_List()
|
||||
{
|
||||
@@ -67,6 +69,7 @@ public class ConfigPumpsRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's FindById method returns null when no entity is found for the specified identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=97e50f0 body=5c74259 -->
|
||||
[Test]
|
||||
public async Task FindAsync_not_Find_id_Return_Empty_List()
|
||||
{
|
||||
@@ -78,6 +81,7 @@ public class ConfigPumpsRepositoryTest
|
||||
/// <summary>
|
||||
/// Tests that inserting a new pump configuration with two items increases the total configuration count to two, that the inserted configuration can be retrieved by its identifier, and that the inserted configuration can be successfully deleted.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=31a6d19 body=72a4a2d -->
|
||||
[Test]
|
||||
public async Task Insert_PumpConfig_returns2()
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@ public class ConfigUnitsRepositoryTest
|
||||
/// <summary>
|
||||
/// Performs one-time setup for integration tests by resetting the <c>config_units</c> collection and seeding it with a single <see cref="ConfigUnits"/> document (Id "PV1") containing two empty <see cref="ConfigUnitItem"/> entries, then initializes the <see cref="ConfigUnitsRepository"/> used by the tests.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=726ef0c -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -54,6 +55,7 @@ public class ConfigUnitsRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>FindById</c> method returns a non-null result when searching by the identifier "PV1".
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=670411f body=fce7952 -->
|
||||
[Test]
|
||||
public async Task FindById_Find_id_Return_List()
|
||||
{
|
||||
@@ -65,6 +67,7 @@ public class ConfigUnitsRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="ConfigUnitsRepository.FindById"/> returns null when invoked with an identifier ("PV2") that does not exist in the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=97e50f0 body=5c74259 -->
|
||||
[Test]
|
||||
public async Task FindAsync_not_Find_id_Return_Empty_List()
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@ public class DiagnosisArchiveRepositoryTest
|
||||
/// archive collection in the integration database, and configuring the diagnosis archive
|
||||
/// repository used by the test suite.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=d9aae18 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -85,6 +86,7 @@ public class DiagnosisArchiveRepositoryTest
|
||||
/// for a given patient that were created before the specified cutoff date, while preserving records
|
||||
/// created on or after that date.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d3a5eeb body=4aa6f1c -->
|
||||
[Test]
|
||||
public async Task DeleteBeforeDate()
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ public class DiagnosisRepositoryTest
|
||||
/// <summary>
|
||||
/// One-time test setup that prepares the integration database for patient diagnosis tests by dropping and recreating the diagnoses collection, inserting three sample <see cref="PatientDiagnosis"/> records (one with predefined test identifiers and two with auto-generated identifiers), and initializing the <see cref="DiagnosisRepository"/> under test.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=df3edc3 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -81,6 +82,7 @@ public class DiagnosisRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository returns a non-null and non-empty collection when retrieving records for an existing patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b07f445 body=1ecc19f -->
|
||||
[Test]
|
||||
public async Task GetByPatient_Find_Patient_Return_List()
|
||||
{
|
||||
@@ -93,6 +95,7 @@ public class DiagnosisRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="DiagnosisRepository.GetByPatient"/> returns an empty list when no records are found for the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=11046fe body=f92c1ae -->
|
||||
[Test]
|
||||
public async Task GetByPatient_not_Find_Patient_Return_Empty_List()
|
||||
{
|
||||
@@ -106,6 +109,7 @@ public class DiagnosisRepositoryTest
|
||||
/// Verifies that <see cref="DiagnosisRepository.FindByPatientIdAndCode"/> successfully retrieves a diagnosis for an existing patient using the provided patient identifier, diagnosis code, and diagnosis system.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous test execution.</returns>
|
||||
/// <!-- aidoc:v1 sig=a4dcbd2 body=164b3c6 -->
|
||||
[Test]
|
||||
public async Task FindByPatientIdAndCode_Find_Patient_Return_Diagnois()
|
||||
{
|
||||
@@ -118,6 +122,7 @@ public class DiagnosisRepositoryTest
|
||||
/// Verifies that <see cref="DiagnosisRepository.FindByPatientIdAndCode"/> returns <c>null</c> when no patient is found
|
||||
/// for the provided patient identifier, code, and diagnosis system.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=610fb3e body=fb08982 -->
|
||||
[Test]
|
||||
public async Task FindByPatientIdAndCode_not_Find_Patient_Return_null()
|
||||
{
|
||||
@@ -129,6 +134,7 @@ public class DiagnosisRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="DiagnosisRepository.FindByPatientIdAsync"/> returns a non-null, non-empty list when looking up an existing patient by their identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=93141f2 body=482ec71 -->
|
||||
[Test]
|
||||
public async Task FindByPatientIdAsync_Find_Patient_Return_List()
|
||||
{
|
||||
@@ -141,6 +147,7 @@ public class DiagnosisRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>FindByPatientIdAsync</c> returns a non-null empty list when no patient matches the provided patient ID.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=364bbfc body=f65d98f -->
|
||||
[Test]
|
||||
public async Task FindByPatientIdAsync_not_Find_Patient_Return_Empty_List()
|
||||
{
|
||||
@@ -153,6 +160,7 @@ public class DiagnosisRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>DeleteAsync</c> removes a patient diagnosis record by its identifier: after insertion, the record is retrievable by patient id, and once deleted, the search by patient id returns no results.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=11927cd body=c622103 -->
|
||||
[Test]
|
||||
public async Task DeleteAsync_Find_id()
|
||||
{
|
||||
@@ -181,6 +189,7 @@ public class DiagnosisRepositoryTest
|
||||
/// by inserting a diagnosis, confirming it can be found, deleting it by patient id, and then
|
||||
/// asserting that no diagnoses remain for that patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=cecd641 body=81c52b1 -->
|
||||
[Test]
|
||||
public async Task DeleteByPatientId_Find_patientId()
|
||||
{
|
||||
@@ -208,6 +217,7 @@ public class DiagnosisRepositoryTest
|
||||
/// Tests that <c>UpdateManyObjectId</c> correctly updates the <c>PatientId</c> field across all matching <see cref="PatientDiagnosis"/> documents by replacing the original ObjectId with a new one.
|
||||
/// Verifies that after the update, the document can be retrieved using the new patient identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=7bfa39c body=54e7d90 -->
|
||||
[Test]
|
||||
public async Task UpdateManyObjectId_With_base_UpdateManyObjectIdAsync()
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ public class DischargeRepositoryTest
|
||||
/// <summary>
|
||||
/// Performs one-time test setup for discharge integration tests by initializing API settings, dropping and recreating the "discharge" collection in the integration database, and instantiating the <see cref="DischargeRepository"/>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=e05a801 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -43,6 +44,7 @@ public class DischargeRepositoryTest
|
||||
/// Verifies that <c>InsertOneAsync</c> successfully persists a discharge document and that the
|
||||
/// inserted record can be retrieved by its identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=8aeeb12 body=9280cf3 -->
|
||||
[Test]
|
||||
public async Task InsertOneAsync_ShouldInsertDischarge()
|
||||
{
|
||||
@@ -59,6 +61,7 @@ public class DischargeRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the <c>Delete</c> repository operation removes a discharge so that subsequent lookups by its identifier return no result.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=e74d1e2 body=34b5447 -->
|
||||
[Test]
|
||||
public async Task Delete_ShouldDeleteDischarge()
|
||||
{
|
||||
@@ -76,6 +79,7 @@ public class DischargeRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that an existing discharge record is successfully updated in the repository with new field values.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=02a52dc body=6496963 -->
|
||||
[Test]
|
||||
public async Task Update_DischargeSuccessfullyUpdated()
|
||||
{
|
||||
@@ -142,6 +146,7 @@ public class DischargeRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>FindAll</c> method returns all discharge records previously inserted via <c>InsertManyAsync</c>, returning a non-null, non-empty collection whose count matches the number of inserted records.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=127b3ea body=394171b -->
|
||||
[Test]
|
||||
public async Task FindAll_ReturnsAllDischarges()
|
||||
{
|
||||
@@ -167,6 +172,7 @@ public class DischargeRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>FindById</c> method returns the matching <c>Discharge</c> document when queried with an existing identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=7d8ccce body=b1b5625 -->
|
||||
[Test]
|
||||
public async Task FindById_ExistingId_ReturnsDischarge()
|
||||
{
|
||||
@@ -183,6 +189,7 @@ public class DischargeRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the discharge repository's FindById method returns <c>null</c> when queried with a non-existent <see cref="ObjectId"/>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=697e175 body=a0d5cfe -->
|
||||
[Test]
|
||||
public async Task FindById_NonExistentId_ReturnsNull()
|
||||
{
|
||||
@@ -214,6 +221,7 @@ public class DischargeRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the discharge repository's FindByDestination method returns the matching discharge records when queried with an existing destination.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a740d08 body=7593742 -->
|
||||
[Test]
|
||||
public async Task FindByDestination_ExistingDestination_ReturnsDischarges()
|
||||
{
|
||||
@@ -236,6 +244,7 @@ public class DischargeRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>FindByDestination</c> returns an empty collection when the provided destination does not match any stored discharge records.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=348dfce body=036788e -->
|
||||
[Test]
|
||||
public async Task FindByDestination_NonExistentDestination_ReturnsEmptyList()
|
||||
{
|
||||
@@ -253,6 +262,7 @@ public class DischargeRepositoryTest
|
||||
/// Verifies that <see cref="DischargeRepository.FindByPoCId"/> returns the matching discharge
|
||||
/// when a discharge is associated with the supplied point-of-care identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81038e3 body=609221c -->
|
||||
[Test]
|
||||
public async Task FindByPoCId_ExistingPoCId_ReturnsDischarges()
|
||||
{
|
||||
@@ -275,6 +285,7 @@ public class DischargeRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the discharge repository's FindByPoCId method returns an empty list when queried with a non-existent PoCId.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d45faee body=ac91c12 -->
|
||||
[Test]
|
||||
public async Task FindByPoCId_NonExistentPoCId_ReturnsEmptyList()
|
||||
{
|
||||
@@ -291,6 +302,7 @@ public class DischargeRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="DischargeRepository.FindByService"/> returns the matching discharge record when a previously inserted discharge exists for the specified service name.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=e99c892 body=45c1f89 -->
|
||||
[Test]
|
||||
public async Task FindByService_ExistingService_ReturnsDischarges()
|
||||
{
|
||||
@@ -313,6 +325,7 @@ public class DischargeRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>FindByService</c> returns an empty list when queried with a service name that does not exist in the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dfafcb5 body=cdd509d -->
|
||||
[Test]
|
||||
public async Task FindByService_NonExistentService_ReturnsEmptyList()
|
||||
{
|
||||
@@ -348,6 +361,7 @@ public class DischargeRepositoryTest
|
||||
/// Verifies that <c>GetDischargeByLocation</c> returns <c>null</c> when queried with a location
|
||||
/// that does not exist in the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=e345a93 body=1c5b68f -->
|
||||
[Test]
|
||||
public async Task GetDischargeByLocation_NonExistentLocation_ReturnsNull()
|
||||
{
|
||||
@@ -364,6 +378,7 @@ public class DischargeRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>GetDischargeByPointOfCareId</c> returns the matching <c>Discharge</c> when queried with a point of care ID that already exists in the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1dff722 body=e61125e -->
|
||||
[Test]
|
||||
public async Task GetDischargeByPointOfCareId_ExistingId_ReturnsDischarge()
|
||||
{
|
||||
@@ -385,6 +400,7 @@ public class DischargeRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>GetDischargeByPointOfCareId</c> returns <c>null</c> when called with a non-existent point of care ID.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=7cb9f72 body=decbb3c -->
|
||||
[Test]
|
||||
public async Task GetDischargeByPointOfCareId_NonExistentId_ReturnsNull()
|
||||
{
|
||||
@@ -402,6 +418,7 @@ public class DischargeRepositoryTest
|
||||
/// Verifies that <c>GetByPatientId</c> returns the matching <see cref="Discharge"/> record
|
||||
/// when a discharge exists for the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1bf90fa body=426641a -->
|
||||
[Test]
|
||||
public async Task GetByPatientId_ExistingPatientId_ReturnsDischarge()
|
||||
{
|
||||
@@ -424,6 +441,7 @@ public class DischargeRepositoryTest
|
||||
/// Verifies that the <see cref="DischargeRepository.GetByPatientId"/> repository method returns <c>null</c>
|
||||
/// when called with a patient ID that does not exist in the data store.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=07ad0d0 body=e034156 -->
|
||||
[Test]
|
||||
public async Task GetByPatientId_NonExistentPatientId_ReturnsNull()
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ public class DisplayConfigTest
|
||||
/// <summary>
|
||||
/// Performs one-time setup for integration tests by initializing the display configuration, card configuration, and detail configuration repositories with test data, including a valid display configuration, a card configuration, and a nurse card details configuration.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=518646b body=8037c13 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task SetUp()
|
||||
{
|
||||
@@ -59,6 +60,7 @@ public class DisplayConfigTest
|
||||
/// <summary>
|
||||
/// One-time teardown method that cleans up the integration test database by dropping the display configuration collections created during testing.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2b9e932 body=c1885a2 -->
|
||||
[OneTimeTearDown]
|
||||
public async Task Cleanup()
|
||||
{
|
||||
@@ -79,6 +81,7 @@ public class DisplayConfigTest
|
||||
/// <summary>
|
||||
/// Verifies that retrieving a display configuration by its identifier returns a non-null result with the associated card and detail configurations populated.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b0680cd body=57902f6 -->
|
||||
[Test]
|
||||
public async Task GetByIdShouldReturnAllConfigsAssociated()
|
||||
{
|
||||
|
||||
@@ -14,6 +14,7 @@ public class DisplayRepisitoryTest
|
||||
/// <summary>
|
||||
/// One-time setup method that resets the "displays" collection in the integration database by dropping and recreating it, ensuring a clean state before integration tests run.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f7b1b92 body=1664d64 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task OneTimeSetUp()
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@ public class HistoricalConfigChangesRepositoryTest
|
||||
/// <summary>
|
||||
/// Performs one-time setup for the test fixture by initializing configuration options, a mocked logger, and the <see cref="HistoricalConfigChangesRepository"/> instance used across the tests.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=706266c body=5308091 -->
|
||||
[OneTimeSetUp]
|
||||
public void Init()
|
||||
{
|
||||
@@ -39,6 +40,7 @@ public class HistoricalConfigChangesRepositoryTest
|
||||
/// <summary>
|
||||
/// Resets the integration test environment by dropping and recreating the <c>historicalConfigChanges</c> collection and then reinitializing the test data. Used as a teardown step to ensure a clean state between tests.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=7ee5718 body=1347954 -->
|
||||
[TearDown]
|
||||
public async Task Cleanup()
|
||||
{
|
||||
@@ -63,6 +65,8 @@ public class HistoricalConfigChangesRepositoryTest
|
||||
/// Seeds the repository with a series of historical configuration change records for an observation configuration
|
||||
/// (Hemoglobina), illustrating successive code updates from "54321" to "xxxxx" to "11111" to "99999" under the "adas" user.
|
||||
/// </summary>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_summary
|
||||
/// "The summary states the code progression ends with '11111' to '99999', but in the third record the OldConfig.Code is '111111' (six 1's), not '11111' (five 1's); the values in record 2's NewConfig ('11111') and record 3's OldConfig ('111111') differ." -->
|
||||
private async Task InitializeData()
|
||||
{
|
||||
var id = ObjectId.GenerateNewId();
|
||||
@@ -143,6 +147,7 @@ public class HistoricalConfigChangesRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>FindAll</c> method returns a non-null collection containing exactly three historical configuration change records after a cleanup operation.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ddd8b40 body=ff905b3 -->
|
||||
[Test]
|
||||
public async Task Get_HistoricalConfigChanges_returns_count_3()
|
||||
{
|
||||
@@ -158,6 +163,7 @@ public class HistoricalConfigChangesRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository <c>Update</c> operation for a <see cref="HistoricalConfigChanges"/> document returns a non-null result whose properties correspond to the updated record, after cleaning up existing data and retrieving an existing entry to be modified.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=4eca1c1 body=4c340da -->
|
||||
[Test]
|
||||
public async Task HistoricalConfigChanges_returns_diferent_document()
|
||||
{
|
||||
@@ -208,6 +214,7 @@ public class HistoricalConfigChangesRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="_repository"/>.FindLastHistoricalConfigChangesByUser returns exactly three historical configuration changes for the user "adas" after cleanup.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2af44db body=322238c -->
|
||||
[Test]
|
||||
public async Task FindLastHistoricalConfigChangesByUser_returns_3()
|
||||
{
|
||||
@@ -221,6 +228,7 @@ public class HistoricalConfigChangesRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that deleting a historical config change entry reduces the total count of records from three to two in the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=95e0ef5 body=246dd28 -->
|
||||
[Test]
|
||||
public async Task Delete_HistoricalConfigChanges_returns_count_2()
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@ public class IntegrationDb
|
||||
/// <summary>
|
||||
/// Initializes the MongoDB integration test environment by starting a MongoDB runner, configuring MongoDB conventions and BSON class mappings, establishing a client from the runner's connection string, and obtaining the target database used by integration tests.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=9ae459a body=d277949 -->
|
||||
[OneTimeSetUp]
|
||||
public void InitIntegrationTests()
|
||||
{
|
||||
@@ -42,6 +43,7 @@ public class IntegrationDb
|
||||
/// If the server does not become available within the timeout, the runner is disposed and a <see cref="TimeoutException"/> is thrown.
|
||||
/// </summary>
|
||||
/// <exception cref="TimeoutException">Thrown when the MongoDB server does not respond within the configured timeout period.</exception>
|
||||
/// <!-- aidoc:v1 sig=cd0b7ec body=775a1ab -->
|
||||
private static async Task StartMongoDbRunner()
|
||||
{
|
||||
Runner = MongoDbRunner.Start();
|
||||
@@ -71,6 +73,7 @@ public class IntegrationDb
|
||||
/// Performs one-time teardown for integration tests by disposing the <see cref="Client"/> and <see cref="Runner"/> resources.
|
||||
/// Safely handles cases where either resource has not been initialized by using null-conditional disposal.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=004ce09 body=c8f0617 -->
|
||||
[OneTimeTearDown]
|
||||
public void TeardownIntegrationTests()
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@ public class MasterListRepositoryTest
|
||||
/// <summary>
|
||||
/// Performs one-time initialization for the test fixture by configuring <see cref="ApiSettings"/> with the expected master list property names, resetting the "MasterLists" collection in the integration database, and creating a <see cref="MasterListRepository{MasterList}"/> instance for use across tests.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=18370f8 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -70,6 +71,7 @@ public class MasterListRepositoryTest
|
||||
/// <summary>
|
||||
/// Performs one-time cleanup after integration test execution by dropping the <c>MasterLists</c> collection from the integration test database to ensure a clean state between test runs.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2b9e932 body=c9319f6 -->
|
||||
[OneTimeTearDown]
|
||||
public async Task Cleanup()
|
||||
{
|
||||
@@ -85,6 +87,7 @@ public class MasterListRepositoryTest
|
||||
/// Verifies that <see cref="MasterList"/> entities are correctly persisted in the repository via <c>InsertOneAsync</c>,
|
||||
/// by inserting an entity and confirming it can be retrieved by its identifier using the default locale.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=bba0e89 body=0ea8cb9 -->
|
||||
[Test]
|
||||
public async Task InsertOneAsync_ShouldInsertEntity()
|
||||
{
|
||||
@@ -104,6 +107,7 @@ public class MasterListRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's Delete operation successfully removes a MasterList entity, ensuring that a subsequent lookup by id returns no result.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=0b44339 body=e17fa20 -->
|
||||
[Test]
|
||||
public async Task Delete_ShouldDeleteEntity()
|
||||
{
|
||||
@@ -122,6 +126,7 @@ public class MasterListRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>Update</c> method successfully persists changes to an existing <see cref="MasterList"/> entity, allowing the modified record to be retrieved by its identifier with the updated values.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=df0490c body=c7537fa -->
|
||||
[Test]
|
||||
public async Task Update_ShouldUpdateEntity()
|
||||
{
|
||||
@@ -143,6 +148,7 @@ public class MasterListRepositoryTest
|
||||
/// Verifies that the repository's FindById method returns the matching entity when a master list with the specified identifier exists in the data store.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous test execution.</returns>
|
||||
/// <!-- aidoc:v1 sig=eb7d5be body=10ec339 -->
|
||||
[Test]
|
||||
public async Task FindById_ShouldReturnEntity_WhenFound()
|
||||
{
|
||||
@@ -269,6 +275,7 @@ public class MasterListRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's FindByName method returns the matching entity when an entity with the specified name exists in the data store.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=e22b4c6 body=4c1dd17 -->
|
||||
[Test]
|
||||
public async Task FindByName_ShouldReturnEntity_WhenFound()
|
||||
{
|
||||
@@ -287,6 +294,7 @@ public class MasterListRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's GetAll method returns all entities, ensuring the result contains at least two items.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a5d7dd2 body=495d5eb -->
|
||||
[Test]
|
||||
public async Task GetAll_ShouldReturnAllEntities()
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ public class MedicineRepositoryTest
|
||||
/// <summary>
|
||||
/// Performs one-time initialization for integration tests by seeding the medicines collection with a test record and verifying it can be retrieved by code or note.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=efc0f36 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -62,6 +63,7 @@ public class MedicineRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>GetMedicineByCodeOrNote</c> returns a non-null, empty list when invoked with an array containing an empty string.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=0e171bf body=07fc7d9 -->
|
||||
[Test]
|
||||
public async Task Get_Medicines_Of_Treatments_Return_Empty_List()
|
||||
{
|
||||
@@ -103,6 +105,7 @@ public class MedicineRepositoryTest
|
||||
/// <summary>
|
||||
/// Tests that the repository returns a non-null medicine when a valid medicine code is found.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=df645bd body=3280632 -->
|
||||
[Test]
|
||||
public async Task GetMedicine_Find_Code_Return_Medicine()
|
||||
{
|
||||
@@ -114,6 +117,7 @@ public class MedicineRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>GetMedicine</c> method returns <c>null</c> when the provided medicine code does not match any existing record.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=65393e1 body=4ad2d58 -->
|
||||
[Test]
|
||||
public async Task GetMedicine_Not_Find_Code_Return_Empty()
|
||||
{
|
||||
@@ -126,6 +130,7 @@ public class MedicineRepositoryTest
|
||||
/// Verifies that the repository returns a non-null medicine when a medicine is found
|
||||
/// by the supplied note identifier ("note1"), confirming successful lookup by note.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=59684de body=fc53426 -->
|
||||
[Test]
|
||||
public async Task GetMedicine_Find_Note_Return_Medicine()
|
||||
{
|
||||
@@ -137,6 +142,7 @@ public class MedicineRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that UpdateMedicine returns the updated medicine and that the changes are persisted and retrievable via GetMedicineById, including the updated notes collection.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=64c3b04 body=e38bac9 -->
|
||||
[Test]
|
||||
public async Task UpdateMedicine_Return_Medicine()
|
||||
{
|
||||
|
||||
@@ -37,6 +37,7 @@ public class MongodbMigrationTest
|
||||
/// <summary>
|
||||
/// Performs one-time initialization for the test fixture by dropping and recreating the "patients" collection, instantiating the PatientRepository, and seeding it with three test Patient records (one of which has a discharge time set to the current time) to verify they are persisted.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=4ef5cc4 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -102,6 +103,7 @@ public class MongodbMigrationTest
|
||||
/// <summary>
|
||||
/// Performs one-time cleanup after integration tests by dropping the <c>patients</c> and <c>__migrations</c> collections from the integration database, ensuring a clean state for subsequent test runs.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=effc73b body=3589ba1 -->
|
||||
[OneTimeTearDown]
|
||||
public void Teardown()
|
||||
{
|
||||
@@ -112,6 +114,7 @@ public class MongodbMigrationTest
|
||||
/// <summary>
|
||||
/// Verifies that the database is detected as outdated by creating a runner and asserting that <c>IsDatabaseUpToDate</c> returns <c>false</c> when using the primary read preference.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=321f15b body=4973696 -->
|
||||
[Test]
|
||||
[Order(1)]
|
||||
public void IsDatabaseOutdated_ShouldReturnTrue()
|
||||
@@ -127,6 +130,7 @@ public class MongodbMigrationTest
|
||||
/// <summary>
|
||||
/// Verifies that after running the migration update to the latest version, the migration with ID 10 (version 0.1.0) is present among the applied migrations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=561899c body=96dbaf9 -->
|
||||
[Test]
|
||||
[Order(2)]
|
||||
public void AfterUpdateToLatest_MigrationShouldBeApplied()
|
||||
@@ -159,6 +163,7 @@ public class MongodbMigrationTest
|
||||
/// Creates and configures a <see cref="MigrationRunner"/> for executing database migrations, using a locator that scans the assembly containing the patient data update migration.
|
||||
/// </summary>
|
||||
/// <returns>A configured <see cref="MigrationRunner"/> bound to the integration database and the migrations collection.</returns>
|
||||
/// <!-- aidoc:v1 sig=10bca02 body=74d6fef -->
|
||||
private MigrationRunner CreateRunner()
|
||||
{
|
||||
var locator = new MigrationLocator();
|
||||
@@ -174,6 +179,7 @@ public class MongodbMigrationTest
|
||||
/// Retrieves the identifiers of all applied migrations from the "__migrations" collection in the integration database.
|
||||
/// </summary>
|
||||
/// <returns>A list of migration identifiers extracted from the "_id" field of each migration document.</returns>
|
||||
/// <!-- aidoc:v1 sig=24bca53 body=dc0f87b -->
|
||||
private List<int> GetAppliedMigrationIds()
|
||||
{
|
||||
var collection = IntegrationDb.Database.GetCollection<BsonDocument>("__migrations");
|
||||
|
||||
@@ -77,6 +77,7 @@ public class ObservationArchiveRepositoryTest
|
||||
/// Verifies that the repository's <c>DeleteBeforeDate</c> method removes all patient observations
|
||||
/// dated before the specified cutoff, leaving only a single observation remaining in the collection.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d3a5eeb body=7b01df8 -->
|
||||
[Test]
|
||||
public async Task DeleteBeforeDate()
|
||||
{
|
||||
|
||||
@@ -33,6 +33,7 @@ public class ObservationRepositoryTest
|
||||
/// and seeds it with six <see cref="PatientObservation"/> records covering different codes, coding systems, and timestamps
|
||||
/// (including observations without a <c>SystemId</c>).
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=3e4af03 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -141,6 +142,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's last observations lookup returns a non-null list containing the expected number of observations for the specified patient, system ("SNM"), and observation code ("code1").
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=88635f6 body=2067a8b -->
|
||||
[Test]
|
||||
public async Task FindLastObservations_Return_List()
|
||||
{
|
||||
@@ -155,6 +157,7 @@ public class ObservationRepositoryTest
|
||||
/// Verifies that FindLastObservationsByCodingSystem returns a non-null list of the expected count
|
||||
/// of the most recent observations for the specified patient filtered by the "SNM" coding system.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=0c960a3 body=f8e4c58 -->
|
||||
[Test]
|
||||
public async Task FindLastObservationsByCodingSystem_Return_List()
|
||||
{
|
||||
@@ -168,6 +171,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the AggregatedPatientLastObservations method returns a non-null list containing the expected number of aggregated last observations for the specified patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1cb45c4 body=0919ea1 -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientLastObservations_Null_Filter_Return_List()
|
||||
{
|
||||
@@ -180,6 +184,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the AggregatedPatientLastObservations repository method returns a non-null filtered list with the expected number of entries when a name filter is provided.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=af78004 body=f4c593b -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientLastObservations_Filter_Return_List()
|
||||
{
|
||||
@@ -194,6 +199,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that AggregatedPatientLastObservations returns an empty list when the provided filter does not match any observations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b7e2192 body=ff9f765 -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientLastObservations_Filter_Not_Find_Return_Empty_List()
|
||||
{
|
||||
@@ -208,6 +214,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>AggregatedPatientLastObservationsByLastDate</c> returns a non-null list of aggregated patient last observations for a given patient and date, even when no filter is applied.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=7a118f0 body=2447117 -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientLastObservationsByLastDate_Null_Filter_Return_List()
|
||||
{
|
||||
@@ -220,6 +227,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that _repository.AggregatedPatientLastObservationsByLastDate returns a non-null list containing the expected number of aggregated patient last observations when a filter is provided.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=effae73 body=630b754 -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientLastObservationsByLastDate_Filter_Return_List()
|
||||
{
|
||||
@@ -234,6 +242,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that AggregatedPatientLastObservationsByLastDate returns an empty list when the provided filter does not match any patient observations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a861d66 body=68738b9 -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientLastObservationsByLastDate_Filter_Not_Find_Return_Empty_List()
|
||||
{
|
||||
@@ -249,6 +258,7 @@ public class ObservationRepositoryTest
|
||||
/// Verifies that AggregatedPatientLastObservationsByField returns a non-null list of aggregated patient last observations
|
||||
/// when the filter is <c>null</c>, confirming the expected fallback behavior and default result set.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=caf7033 body=c85338e -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientLastObservationsByField_Null_Filter_Return_List()
|
||||
{
|
||||
@@ -261,6 +271,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Tests that filtering aggregated patient last observations by a specific field returns a non-null list containing the expected number of results.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=5917458 body=a5282a6 -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientLastObservationsByField_Filter_Return_List()
|
||||
{
|
||||
@@ -276,6 +287,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that _repository.AggregatedPatientLastObservationsByField returns an empty list when the filter field has <c>OnlyExpired</c> set to <c>true</c>, indicating no expired observations are available for the patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=276c465 body=3f97cba -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientLastObservationsByField_Filter_OnlyExpired_Return_Empty_List()
|
||||
{
|
||||
@@ -294,6 +306,7 @@ public class ObservationRepositoryTest
|
||||
/// The test inserts a single observation, confirms it is persisted, deletes it by
|
||||
/// patient id, and asserts that no records remain for that patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=79b17ee body=9f320fb -->
|
||||
[Test]
|
||||
public async Task DeleteByPatientId()
|
||||
{
|
||||
@@ -327,6 +340,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that FindByPatientIdAsync returns a non-null cursor containing the expected number of records for the specified patient identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d18d952 body=133ddc6 -->
|
||||
[Test]
|
||||
public async Task FindByPatientIdAsync_Return_Cursor()
|
||||
{
|
||||
@@ -339,6 +353,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="DeleteAsync"/> correctly removes a patient observation from the repository by inserting a record, confirming its presence, deleting it, and ensuring it is no longer retrievable.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=fff9e82 body=a6a87ee -->
|
||||
[Test]
|
||||
public async Task DeleteAsync()
|
||||
{
|
||||
@@ -372,6 +387,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>DeleteOlderDaysAsync</c> method removes <see cref="PatientObservation"/> records older than the specified day threshold while keeping more recent ones, and that <c>DeleteByPatientId</c> subsequently clears the remaining records associated with the same patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=da9fb95 body=8dfd6d6 -->
|
||||
[Test]
|
||||
public async Task DeleteOlderDaysAsync()
|
||||
{
|
||||
@@ -425,6 +441,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>DeleteOlderSecondsAsync</c> removes <c>PatientObservation</c> entries whose timestamp is older than the specified number of seconds, keeping more recent entries with the same name intact, and that <c>DeleteByPatientId</c> clears all remaining observations for the given patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=9941ee8 body=377855c -->
|
||||
[Test]
|
||||
public async Task DeleteOlderSecondsAsync()
|
||||
{
|
||||
@@ -479,6 +496,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>DeleteOlderNumberAsync</c> method retains only the most recent specified count of <see cref="PatientObservation"/> records sharing the same name, deleting the older entries, and that <c>DeleteByPatientId</c> subsequently removes all remaining records for the patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=340569b body=00db271 -->
|
||||
[Test]
|
||||
public async Task DeleteOlderNumberAsync()
|
||||
{
|
||||
@@ -546,6 +564,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that _repository.<c>ExistBySystemId</c> returns a valid result when checking existence by the given patient and system identifiers.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=4a76800 body=c1adb09 -->
|
||||
[Test]
|
||||
public async Task ExistBySystemId_Return_List()
|
||||
{
|
||||
@@ -558,6 +577,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that FindLastObservationBeforeDate returns a non-null observation whose timestamp is earlier than the specified date, confirming a matching record is retrieved successfully.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=c4f6209 body=029c0ad -->
|
||||
[Test]
|
||||
public async Task FindLastObservationBeforeDate_Return_Obs()
|
||||
{
|
||||
@@ -571,6 +591,7 @@ public class ObservationRepositoryTest
|
||||
/// Verifies that the repository's <c>FindAnyWithSameDate</c> method returns a non-null list containing exactly one observation
|
||||
/// when searching for observations associated with the specified patient, name, and date.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f4d1d6e body=13ab188 -->
|
||||
[Test]
|
||||
public async Task FindAnyWithSameDate_Return_List_Obs()
|
||||
{
|
||||
@@ -583,6 +604,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Tests that the repository returns a non-null list of two observations for a patient, found before the specified date (yesterday).
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=7625bc5 body=4184aa0 -->
|
||||
[Test]
|
||||
public async Task FindAnyBeforeDate_Return_List_Obs()
|
||||
{
|
||||
@@ -595,6 +617,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that AggregatedPatientActiveIntravenousLinesObservations returns a non-null, empty list of observations for the specified patient when no filter criteria are provided.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=443bc38 body=fa1727f -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientActiveIntravenousLinesObservations_Null_Filter_Return_List_Obs()
|
||||
{
|
||||
@@ -607,6 +630,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that _repository.AggregatedPatientActiveIntravenousLinesObservations returns an empty list of observations when the filter value is not the Patient Intravenous Lines value.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=222e074 body=fa1727f -->
|
||||
[Test]
|
||||
public async Task
|
||||
AggregatedPatientActiveIntravenousLinesObservations_Filter_Not_PatientIntravenousLineasValue_Return_List_Obs()
|
||||
@@ -622,6 +646,7 @@ public class ObservationRepositoryTest
|
||||
/// when filtering by patient id and the observation value is a <c>PatientIntravenousLinesValue</c> instance.
|
||||
/// The test inserts a single matching observation, asserts that exactly one record is returned, and confirms successful cleanup by deletion.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=de0f13c body=e70da59 -->
|
||||
[Test]
|
||||
public async Task
|
||||
AggregatedPatientActiveIntravenousLinesObservations_Filter_PatientIntravenousLineasValue_Return_List_Obs()
|
||||
@@ -663,6 +688,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository method <c>FindAllLastPatientObservationTime</c> returns a non-null collection containing at least one last patient observation time record.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ae4ea39 body=e0d34c8 -->
|
||||
[Test]
|
||||
public async Task FindAllLastPatientObservationTime_Return_List()
|
||||
{
|
||||
@@ -675,6 +701,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>FindById</c> method returns <c>null</c> when the requested entity does not exist in the data store.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=fa5827c body=aa8e2ed -->
|
||||
[Test]
|
||||
public async Task FindById_Return_null()
|
||||
{
|
||||
@@ -686,6 +713,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>FindById</c> method returns a non-null entity whose identifier matches the requested <c>Id</c>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a8a8a1f body=5c4b5c9 -->
|
||||
[Test]
|
||||
public async Task FindById_Return_Obs()
|
||||
{
|
||||
@@ -699,6 +727,7 @@ public class ObservationRepositoryTest
|
||||
/// Verifies that the repository's <c>UpdateExpiredObservations</c> method correctly marks all non-expired observations belonging to a patient as expired.
|
||||
/// The test inserts five fresh observations, asserts that none are expired, invokes the update, and then asserts that all five have been flagged as expired before cleaning up the inserted data.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b94178a body=272a747 -->
|
||||
[Test]
|
||||
public async Task UpdateExpiredObservations()
|
||||
{
|
||||
@@ -753,6 +782,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>FindAll</c> method returns a non-null and non-empty collection of patient observations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b6f854b body=d3aacf4 -->
|
||||
[Test]
|
||||
public async Task FindAll_Return_List_Obs()
|
||||
{
|
||||
@@ -766,6 +796,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>FindNotExpired</c> method returns a non-empty collection of patient observations for the provided observation names.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=8432757 body=44f224f -->
|
||||
[Test]
|
||||
public async Task FindNotExpired_Return_List_Obs()
|
||||
{
|
||||
@@ -781,6 +812,7 @@ public class ObservationRepositoryTest
|
||||
/// configuration observations as expired so that a subsequent _repository.FindNotExpired
|
||||
/// call returns only the remaining non-expired observations, deduplicating the requested names.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f38e833 body=a355c89 -->
|
||||
[Test]
|
||||
public async Task ExpireExpiredObservations()
|
||||
{
|
||||
@@ -824,6 +856,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>FindByName</c> method returns a non-null, non-empty list of <see cref="PatientObservation"/> objects when searching by the name "name1".
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=4909264 body=8a20493 -->
|
||||
[Test]
|
||||
public async Task FindByName_Return_List_Obs()
|
||||
{
|
||||
@@ -837,6 +870,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>AggregatedPatientGroupedObservations</c> returns a non-null, empty list when called with a default <see cref="GroupedField"/> instance for the given patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ba3950a body=ab60777 -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientGroupedObservations_Null_groupedField_Return_List_Emty()
|
||||
{
|
||||
@@ -855,6 +889,7 @@ public class ObservationRepositoryTest
|
||||
/// are aggregated for a patient using the First result selection strategy with a maximum of 8 groups.
|
||||
/// Verifies successful aggregation and ensures all inserted test observations are removed by patient id.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ddd2397 body=6da0755 -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientGroupedObservations_Hour_Firs_Return_List_9()
|
||||
{
|
||||
@@ -908,6 +943,7 @@ public class ObservationRepositoryTest
|
||||
/// Inserts 30 observations, asserts the aggregated result count is 8, and confirms cleanup by patient id removes all inserted records.
|
||||
/// </summary>
|
||||
/// <returns>A task that completes when the test finishes, including assertions and cleanup.</returns>
|
||||
/// <!-- aidoc:v1 sig=16bfc4b body=6ec573c -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientGroupedObservations_Hour_Firs_Since_Last_Return_List_8()
|
||||
{
|
||||
@@ -959,6 +995,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that inserting five patient observations with hourly regularity and aggregating them using the first result returns a list of four or five grouped entries, and ensures the inserted observations are removed by patient id.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b1196b2 body=b383d16 -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_Firs_Return_List_5()
|
||||
{
|
||||
@@ -1010,6 +1047,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>AggregatedPatientGroupedObservations</c> returns a non-empty list when patient observations are grouped by a field with second-level regularity and the aggregation selects only the first result per group, and that the inserted observations are fully removed by the cleanup step.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=979ce59 body=7455833 -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientGroupedObservations_second_Firs_Return_List()
|
||||
{
|
||||
@@ -1060,6 +1098,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the aggregated grouped observations query, configured with minute regularity, the <c>First</c> result and a maximum of 8, returns a list of exactly 8 entries even when 30 underlying observations exist for the patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=26e8af5 body=afe533b -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientGroupedObservations_Minute_Firs_Return_List_8()
|
||||
{
|
||||
@@ -1113,6 +1152,7 @@ public class ObservationRepositoryTest
|
||||
/// Also confirms that observations inserted for the test patient are removed by the cleanup step.
|
||||
/// </summary>
|
||||
/// <returns>A task that completes when the aggregation result is validated and the test data is cleaned up.</returns>
|
||||
/// <!-- aidoc:v1 sig=ac82ee8 body=f55a331 -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientGroupedObservations_Day_Firs_Return_List_8()
|
||||
{
|
||||
@@ -1163,6 +1203,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>AggregatedPatientGroupedObservations</c> returns a list of 9 entries containing the "first" marker when grouping 30 patient observations by a shift-regularity field with a max of 8 and <c>Result.First</c> selected, and that all inserted observations are removed by the cleanup call.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=908c690 body=45a4df9 -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientGroupedObservations_Shift_Firs_Return_List_9()
|
||||
{
|
||||
@@ -1216,6 +1257,8 @@ public class ObservationRepositoryTest
|
||||
/// Inserts two observations for each of the last 5 hours (at minutes 15 and 30), runs the aggregation for a new patient, and verifies the result count is 5 and that every entry contains the "last" marker.
|
||||
/// Cleanup is performed by deleting the inserted observations by patient id and asserting that the collection is empty afterwards.
|
||||
/// </summary>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_summary
|
||||
/// "First sentence states '5 observations are inserted per hour' but the code inserts 2 observations per hour (at minutes 15 and 30) across 5 hours. The subsequent sentence correctly clarifies this." -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_last_Return_List_5()
|
||||
{
|
||||
@@ -1293,6 +1336,7 @@ public class ObservationRepositoryTest
|
||||
/// into hourly groups and returns the sum of values for each hour when five hours of data are inserted.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous test execution.</returns>
|
||||
/// <!-- aidoc:v1 sig=70c846f body=b222435 -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_sum_Return_List_5()
|
||||
{
|
||||
@@ -1377,6 +1421,7 @@ public class ObservationRepositoryTest
|
||||
/// AggregatedPatientGroupedObservations returns a list of five entries, each containing the minimum value of 3.
|
||||
/// Also confirms that observations are cleaned up by patient id after the test executes.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=46c6e82 body=eb3a01b -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_Min_Return_List_5()
|
||||
{
|
||||
@@ -1455,6 +1500,7 @@ public class ObservationRepositoryTest
|
||||
/// maximum value for each group, producing one aggregated result per hour when inserting two observations
|
||||
/// (with different values) for each of five consecutive hours.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=fe72045 body=5459e9e -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_Max_Return_List_5()
|
||||
{
|
||||
@@ -1537,6 +1583,7 @@ public class ObservationRepositoryTest
|
||||
/// Inserts 10 observations across 5 different hours (two per hour with values 5 and 3), verifies the result count is 5, and asserts that each entry contains the "average" field with a value of 3 or 4.
|
||||
/// Cleans up by deleting all observations for the test patient after verification.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=41afdfe body=ac8d03f -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_Average_Return_List_5()
|
||||
{
|
||||
@@ -1619,6 +1666,7 @@ public class ObservationRepositoryTest
|
||||
/// Inserts ten observations (two per hour for five consecutive hours) for a new patient, runs the aggregation, and asserts that the result contains five entries each reporting a count of 1 or 2.
|
||||
/// Also confirms that cleanup via <c>DeleteByPatientId</c> removes the inserted observations for the generated patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=86524d8 body=92a501b -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_Count_Return_List_5()
|
||||
{
|
||||
@@ -1701,6 +1749,7 @@ public class ObservationRepositoryTest
|
||||
/// Inserts two sets of observations at different minute offsets across the last five hours, then asserts the aggregation result count matches the expected number of groups and the "all" subset is returned.
|
||||
/// Also validates cleanup by ensuring no observations remain for the test patient after deletion.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2bb5c5e body=3897462 -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_HalfHour_Return_List_5()
|
||||
{
|
||||
@@ -1794,6 +1843,7 @@ public class ObservationRepositoryTest
|
||||
/// observation value (either 5 or 3 depending on insertion order) and that the inserted test data is
|
||||
/// cleaned up afterwards.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=40fc878 body=161ff4e -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_LastFilled_Return_List_5()
|
||||
{
|
||||
@@ -1876,6 +1926,7 @@ public class ObservationRepositoryTest
|
||||
/// <summary>
|
||||
/// Tests that the repository's aggregated patient grouped observations, configured with hourly regularity and the LastAll result option, returns a list of 5 entries when 5 hours of data are inserted (with two observations per hour at minutes 15 and 31), and verifies that cleanup by patient ID removes all inserted records.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=03215f8 body=3230a69 -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientGroupedObservations_Insert_5_Hour_LastAll_Return_List_5()
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ public class PatientArchiveRepositoryTest
|
||||
/// Performs one-time setup for integration tests by seeding the patient archive collection
|
||||
/// with three predefined <see cref="Patient"/> records after resetting the collection.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=325d090 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -92,6 +93,7 @@ public class PatientArchiveRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the FindByPatientNumber repository method returns null when no record is found for the provided patient number.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=34ec3bc body=1ed0bbb -->
|
||||
[Test]
|
||||
public async Task FindByPatientNumber_Not_Find_Return_null()
|
||||
{
|
||||
@@ -105,6 +107,7 @@ public class PatientArchiveRepositoryTest
|
||||
/// matching the provided patient number, ensuring the returned patient is not null and has
|
||||
/// the expected PatientNumber.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=c0d3b04 body=73af217 -->
|
||||
[Test]
|
||||
public async Task FindByPatientNumber_Find_Return_Patient()
|
||||
{
|
||||
@@ -117,6 +120,7 @@ public class PatientArchiveRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>FindAll</c> method returns a non-null list containing the expected number of patient records.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d5ae514 body=7b8d43f -->
|
||||
[Test]
|
||||
public async Task FindAll_Return_List_Patients()
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@ public class PatientRepositoryTest
|
||||
/// list records, then verifies that the initial bulk insert yields exactly five patient
|
||||
/// documents.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=e3a0acd -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -239,6 +240,7 @@ public class PatientRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that _repository.FindInActivePoC returns a non-null result containing exactly three inactive PoC entries.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=511005a body=96a1c82 -->
|
||||
[Test]
|
||||
public async Task FindInActivePoC()
|
||||
{
|
||||
@@ -251,6 +253,7 @@ public class PatientRepositoryTest
|
||||
/// Verifies that _repository.FindInInactivePoC() returns a non-null collection containing exactly two inactive PoC records.
|
||||
/// </summary>
|
||||
/// <returns>A Task representing the asynchronous test execution.</returns>
|
||||
/// <!-- aidoc:v1 sig=00839fb body=3eb509a -->
|
||||
[Test]
|
||||
public async Task FindInInactivePoC()
|
||||
{
|
||||
@@ -262,6 +265,7 @@ public class PatientRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that FindById returns the expected <c>Patient</c> when a valid patient identifier is provided, ensuring the result is not null and the <c>PatientNumber</c> matches the expected value.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=4d059ea body=2e321e5 -->
|
||||
[Test]
|
||||
public async Task FindById_Find_Return_Patient()
|
||||
{
|
||||
@@ -274,6 +278,7 @@ public class PatientRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>FindByPatientNumber</c> method returns <c>null</c> when invoked with an empty patient number, confirming the not-found scenario for blank input.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=3dd54bc body=1ed0bbb -->
|
||||
[Test]
|
||||
public async Task FindByPatientNumber_Not_Find_Return_Patient()
|
||||
{
|
||||
@@ -287,6 +292,7 @@ public class PatientRepositoryTest
|
||||
/// a patient when called with a valid patient number, returning a non-null result
|
||||
/// with a matching <c>PatientNumber</c>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=c0d3b04 body=73af217 -->
|
||||
[Test]
|
||||
public async Task FindByPatientNumber_Find_Return_Patient()
|
||||
{
|
||||
@@ -299,6 +305,7 @@ public class PatientRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>FindAll</c> method returns a non-null list containing all expected patient records (five entries).
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d5ae514 body=c6cf2c0 -->
|
||||
[Test]
|
||||
public async Task FindAll_Return_List_Patients()
|
||||
{
|
||||
@@ -314,6 +321,7 @@ public class PatientRepositoryTest
|
||||
/// the new value is not present prior to the update operation. Also validates that the updated record
|
||||
/// is persisted with the modified value and that the patient can be cleaned up via <c>Delete</c>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=47a1bec body=826570a -->
|
||||
[Test]
|
||||
public async Task Update_with_base_UpdateOneAsync()
|
||||
{
|
||||
@@ -367,6 +375,7 @@ public class PatientRepositoryTest
|
||||
/// Verifies that a patient can be successfully deleted from the repository by inserting a patient,
|
||||
/// confirming it exists, deleting it, and then confirming it is no longer retrievable.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=122f4c1 body=bdb3f7b -->
|
||||
[Test]
|
||||
public async Task Delete()
|
||||
{
|
||||
@@ -439,6 +448,7 @@ public class PatientRepositoryTest
|
||||
/// Tests that the attending doctor of a point of care entry can be successfully updated with a new doctor.
|
||||
/// Verifies that after the update, the entry retrieved by point of care reflects the new attending doctor's information.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=6f5c72a body=7989ba8 -->
|
||||
[Test]
|
||||
public async Task UpdateAttendingDoctor()
|
||||
{
|
||||
@@ -629,6 +639,7 @@ public class PatientRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that _repository.FindByPatientId returns <c>null</c> when no patient is found for the provided patient identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2ee2a87 body=5435f7d -->
|
||||
[Test]
|
||||
public async Task FindByPatientId_Not_Find_Return_Patient()
|
||||
{
|
||||
@@ -649,6 +660,7 @@ public class PatientRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository returns a non-null and non-empty collection of patients when searching by the identifier of an existing point of care.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=3c4dd97 body=12ec03f -->
|
||||
[Test]
|
||||
public async Task FindByPointOfCare_Find_Return_Patients()
|
||||
{
|
||||
@@ -662,6 +674,7 @@ public class PatientRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that _repository.FindByPointOfCare returns a non-null empty collection when no patients match the provided point of care identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ddb2f09 body=bc4f7e5 -->
|
||||
[Test]
|
||||
public async Task FindByPointOfCare_Not_Find_Return_Patients()
|
||||
{
|
||||
@@ -674,6 +687,7 @@ public class PatientRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository returns a non-null and non-empty collection of discharged patients when calling <c>FindDischargedPatients</c>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=35a586f body=e6a17fd -->
|
||||
[Test]
|
||||
public async Task FindDischargedPatients_Find_Return_Patients()
|
||||
{
|
||||
|
||||
@@ -20,6 +20,7 @@ public class PoCMappingRepositoryTest
|
||||
/// <summary>
|
||||
/// Performs one-time setup for integration tests by seeding the "mappings" collection with a sample <see cref="PoCMapping"/> document, where a single point of care is mapped from an original value to a new one across eleven bed entries, and initializing the <see cref="PoCMappingRepository"/> against the integration database.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=cf0b9af -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -71,6 +72,7 @@ public class PoCMappingRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that finding a mapping by the key "PV1" returns a non-null result containing point of care entries with at least one associated bed.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2e75ef3 body=918af14 -->
|
||||
[Test]
|
||||
public async Task FindByKey_Find_Return_Mapping()
|
||||
{
|
||||
@@ -84,6 +86,7 @@ public class PoCMappingRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's FindByKey method returns null when the provided key does not correspond to an existing entity, confirming the not-found behavior.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=7839679 body=2c9e795 -->
|
||||
[Test]
|
||||
public async Task FindByKey_Not_Find_Return_Mapping()
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@ public class PoCSettingsRepositoryTest
|
||||
/// <summary>
|
||||
/// One-time setup that prepares the integration test environment by resetting the PoC settings collection in the integration database, seeding it with test data, and instantiating the <see cref="PoCSettingsRepository"/> used by the test fixture.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=dcc8a2f -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -55,6 +56,7 @@ public class PoCSettingsRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that calling the Delete method with an existing PoCSettings identifier removes the corresponding record from the repository, resulting in a null lookup via FindById.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=fe40c5f body=05bfdc8 -->
|
||||
[Test]
|
||||
public async Task Delete_WhenCalled_ShouldRemovePoCSettings()
|
||||
{
|
||||
@@ -78,6 +80,7 @@ public class PoCSettingsRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>FindAll</c> method returns a non-null and non-empty collection of PoC settings.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=7098a75 body=efda3dd -->
|
||||
[Test]
|
||||
public async Task FindAll_WhenCalled_ShouldReturnAllPoCSettings()
|
||||
{
|
||||
@@ -92,6 +95,7 @@ public class PoCSettingsRepositoryTest
|
||||
/// <summary>
|
||||
/// Tests that FindById returns a non-null PoC settings object whose identifier matches the requested value.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d657f65 body=3e8fc10 -->
|
||||
[Test]
|
||||
public async Task FindById_WhenCalled_ShouldReturnPoCSettings()
|
||||
{
|
||||
@@ -106,6 +110,7 @@ public class PoCSettingsRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that _repository.FindByLocation returns a PoC settings object matching the requested patient location.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ad74af5 body=0b6fc4b -->
|
||||
[Test]
|
||||
public async Task FindByLocation_WhenCalled_ShouldReturnPoCSettings()
|
||||
{
|
||||
@@ -121,6 +126,7 @@ public class PoCSettingsRepositoryTest
|
||||
/// Verifies that the repository correctly updates an existing PoCSettings entity, specifically ensuring that the associated PatientLocation properties (such as Bed) are persisted after the update operation.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous test execution.</returns>
|
||||
/// <!-- aidoc:v1 sig=767a442 body=1a3df29 -->
|
||||
[Test]
|
||||
public async Task Update_WhenCalled_ShouldUpdatePoCSettings()
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@ public class PointOfCareRepositoryTests
|
||||
/// Performs one-time setup for integration tests by initializing mock dependencies and resetting the
|
||||
/// "pointOfCares" MongoDB collection before instantiating the <see cref="PointOfCareRepository"/>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=9ad8f9b -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -47,6 +48,7 @@ public class PointOfCareRepositoryTests
|
||||
/// <summary>
|
||||
/// Verifies that InsertOneAsync successfully inserts a valid point of care into the repository and that the record can be retrieved by its identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=00a9141 body=70e9995 -->
|
||||
[Test]
|
||||
public async Task InsertOneAsync_ValidPointOfCare_InsertsSuccessfully()
|
||||
{
|
||||
@@ -65,6 +67,7 @@ public class PointOfCareRepositoryTests
|
||||
/// Verifies that the Delete method successfully removes a point of care from the repository when given a valid identifier.
|
||||
/// Inserts a point of care, deletes it by its identifier, and asserts that the entity can no longer be retrieved.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=9eb1fdd body=846deca -->
|
||||
[Test]
|
||||
public async Task Delete_ValidId_DeletesSuccessfully()
|
||||
{
|
||||
@@ -81,6 +84,7 @@ public class PointOfCareRepositoryTests
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="PointOfCare"/> entities can be updated successfully when valid data is provided, ensuring that modified properties such as <c>Room</c> and <c>Bed</c> are persisted and retrievable after the update operation.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=99cfbc0 body=7b6162a -->
|
||||
[Test]
|
||||
public async Task Update_ValidPointOfCare_UpdatesSuccessfully()
|
||||
{
|
||||
@@ -108,6 +112,7 @@ public class PointOfCareRepositoryTests
|
||||
/// <summary>
|
||||
/// Verifies that the repository's <c>FindById</c> method returns the correct <c>PointOfCare</c> document when queried with an existing identifier, by inserting a document and asserting that the retrieved entity matches the expected one.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d0f97dc body=a90f309 -->
|
||||
[Test]
|
||||
public async Task FindById_ExistingId_ReturnsPointOfCare()
|
||||
{
|
||||
@@ -131,6 +136,7 @@ public class PointOfCareRepositoryTests
|
||||
/// <summary>
|
||||
/// Verifies that FindByUnitAndStatus returns the matching <c>PointOfCare</c> documents when queried with an existing unit identifier and status.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1ec4a01 body=7d0923f -->
|
||||
[Test]
|
||||
public async Task FindByUnitAndStatus_ExistingUnitAndStatus_ReturnsMatchingPointOfCares()
|
||||
{
|
||||
@@ -156,6 +162,7 @@ public class PointOfCareRepositoryTests
|
||||
/// Inserts a valid <c>PointOfCare</c> into the repository and verifies the search by room returns a non-null collection
|
||||
/// containing the expected entity. Assertions are only executed when the inserted <c>PointOfCare</c> has a non-null <c>Unit</c>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b29834f body=5f527db -->
|
||||
[Test]
|
||||
public async Task FindByRoom_ValidRoom_ReturnsMatchingPointOfCares()
|
||||
{
|
||||
@@ -180,6 +187,7 @@ public class PointOfCareRepositoryTests
|
||||
/// <summary>
|
||||
/// Verifies that the repository returns the matching PointOfCare when queried with a valid bed identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ee4a489 body=e8d8078 -->
|
||||
[Test]
|
||||
public async Task FindByBed_ValidBed_ReturnsMatchingPointOfCares()
|
||||
{
|
||||
@@ -203,6 +211,7 @@ public class PointOfCareRepositoryTests
|
||||
/// <summary>
|
||||
/// Verifies that the <c>GetAll</c> repository method returns all stored <c>PointOfCare</c> entries, including a newly inserted one identified by its assigned Id.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=054a987 body=913ed8f -->
|
||||
[Test]
|
||||
public async Task GetAll_ReturnsAllPointOfCares()
|
||||
{
|
||||
|
||||
@@ -36,6 +36,8 @@ public class PumpAlarmEventRepositoryTest
|
||||
/// alarm events covering both Device and DeviceB across attention and occlusion
|
||||
/// alarm types. Verifies that exactly three documents are present after seeding.
|
||||
/// </summary>
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_summary
|
||||
/// "The summary mentions 'covering both Device and DeviceB' instead of 'DeviceA and DeviceB' (DeviceA actually has 2 of the 3 seeded events)" -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -96,6 +98,7 @@ public class PumpAlarmEventRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that InsertAsync correctly persists a <see cref="PumpAlarmEvent"/> to the repository by inserting an event and confirming it can be retrieved by its identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2215003 body=c74afba -->
|
||||
[Test]
|
||||
public async Task InsertAsync_Works()
|
||||
{
|
||||
@@ -120,6 +123,7 @@ public class PumpAlarmEventRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>FindByDeviceIdAsync</c> returns a non-empty collection of records for the specified device, ordered by time so that the most recent entry appears first.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=01527dc body=aa6b0c8 -->
|
||||
[Test]
|
||||
public async Task FindByDeviceIdAsync_ReturnsOrdered()
|
||||
{
|
||||
@@ -137,6 +141,7 @@ public class PumpAlarmEventRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>FindByDeviceIdAsync</c> returns only pump alarm events whose timestamps fall within the specified date range.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=181c278 body=5238e21 -->
|
||||
[Test]
|
||||
public async Task FindByDeviceIdAsync_WithDateRange_Works()
|
||||
{
|
||||
@@ -156,6 +161,7 @@ public class PumpAlarmEventRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>FindByDeviceIdAsync</c> returns at most the specified number of results when a limit is provided.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=88ed78c body=d3ad079 -->
|
||||
[Test]
|
||||
public async Task FindByDeviceIdAsync_WithLimit_Works()
|
||||
{
|
||||
@@ -195,6 +201,7 @@ public class PumpAlarmEventRepositoryTest
|
||||
/// Verifies that DeleteByPatientId correctly removes all alarm events associated with a given patient.
|
||||
/// Inserts a sample <c>PumpAlarmEvent</c> for a specific patient, deletes it by patient ID, and asserts that no matching events remain in the collection.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d53a759 body=f0c6227 -->
|
||||
[Test]
|
||||
public async Task DeleteByPatientId_Works()
|
||||
{
|
||||
@@ -224,6 +231,7 @@ public class PumpAlarmEventRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>UpdateManyObjectIdByFiledNameAsync</c> correctly updates documents matching the specified field name and old ObjectId value, replacing it with the new ObjectId, and that the changes are persisted and queryable.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=de41de1 body=b093999 -->
|
||||
[Test]
|
||||
public async Task UpdateManyObjectIdByFiledNameAsync_Works()
|
||||
{
|
||||
@@ -252,6 +260,7 @@ public class PumpAlarmEventRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>FindByDeviceIdAsync</c> returns an empty result when the queried date range falls outside of the available data window.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1cb5677 body=2bd06ed -->
|
||||
[Test]
|
||||
public async Task FindByDeviceIdAsync_ReturnsEmpty_WhenOutOfRange()
|
||||
{
|
||||
@@ -267,6 +276,7 @@ public class PumpAlarmEventRepositoryTest
|
||||
/// Verifies that <c>FindByDeviceIdAsync</c> correctly applies the requested limit and orders results so that the most recent alarm event for the given device is returned first.
|
||||
/// Seeds multiple events for the target device, requests a single record, and asserts that the returned entry matches the latest event retrieved by <c>FindLastByDeviceIdAsync</c>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=0ace983 body=f479d09 -->
|
||||
[Test]
|
||||
public async Task FindByDeviceIdAsync_RespectsLimitAndOrder()
|
||||
{
|
||||
@@ -292,6 +302,7 @@ public class PumpAlarmEventRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that InsertAsync successfully persists a <see cref="PumpAlarmEvent"/> when its optional fields (<c>PatientId</c> and <c>AlarmType</c>) are <c>null</c>, and that the record can be retrieved afterwards.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=6674243 body=d84c3f0 -->
|
||||
[Test]
|
||||
public async Task InsertAsync_AllowsNullOptionalFields()
|
||||
{
|
||||
@@ -313,6 +324,7 @@ public class PumpAlarmEventRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>DeleteByPatientId</c> removes all alarm events associated with the given patient and can be invoked repeatedly without throwing once the records no longer exist.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2c04cf9 body=6548dfc -->
|
||||
[Test]
|
||||
public async Task DeleteByPatientId_DeletesMany_AndIsIdempotent()
|
||||
{
|
||||
@@ -342,6 +354,7 @@ public class PumpAlarmEventRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>UpdateManyObjectIdByFiledNameAsync</c> updates the <c>PatientId</c> field from an old <see cref="ObjectId"/> to a new one across all matching documents, returning the modified count and persisting the new identifier in the collection.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=898d198 body=909945a -->
|
||||
[Test]
|
||||
public async Task UpdateManyObjectIdByFiledNameAsync_UpdatesMultiple()
|
||||
{
|
||||
@@ -373,6 +386,7 @@ public class PumpAlarmEventRepositoryTest
|
||||
/// ensuring events whose timestamp matches the upper bound exactly are returned and that all returned
|
||||
/// events fall within the supplied range.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=21f5b81 body=0975796 -->
|
||||
[Test]
|
||||
public async Task FindByDeviceIdAsync_InclusiveRange_BoundsRespected()
|
||||
{
|
||||
@@ -403,6 +417,7 @@ public class PumpAlarmEventRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that FindLastByDeviceIdAsync returns the most recent alarm event for a given device and tracks newly inserted events as the latest entry.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d24d18d body=a473c62 -->
|
||||
[Test]
|
||||
public async Task FindLastByDeviceIdAsync_TracksNewest()
|
||||
{
|
||||
@@ -428,6 +443,7 @@ public class PumpAlarmEventRepositoryTest
|
||||
/// and time range when multiple queries are issued against overlapping windows, ensuring each
|
||||
/// range returns only the event that falls within its boundaries.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=62e28e4 body=55ca12b -->
|
||||
[Test]
|
||||
public async Task FindByDeviceIdAsync_MultipleOverlappingRanges()
|
||||
{
|
||||
|
||||
@@ -34,6 +34,7 @@ public class PumpAlarmStateRepositoryTest
|
||||
/// One-time setup that prepares the integration test environment for <see cref="PumpAlarmStateRepository"/>.
|
||||
/// Configures the API settings, drops and recreates the "pump_alarm_state" collection, instantiates the repository with its indexes, and seeds three initial alarm state records across two devices, verifying the seeded count.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=321fe16 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -96,6 +97,7 @@ public class PumpAlarmStateRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>FindActiveAsync</c> returns the correct active alarm matching the specified device identifier, alarm type, and alarm code.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=6e7817c body=1072320 -->
|
||||
[Test]
|
||||
public async Task FindActiveAsync_ReturnsCorrectAlarm()
|
||||
{
|
||||
@@ -113,6 +115,7 @@ public class PumpAlarmStateRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>FindActiveAsync</c> returns <c>null</c> when no active alarm matching the specified device, alarm type, and identifier exists.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=448af76 body=5d7c302 -->
|
||||
[Test]
|
||||
public async Task FindActiveAsync_ReturnsNull_WhenNotFound()
|
||||
{
|
||||
@@ -128,6 +131,7 @@ public class PumpAlarmStateRepositoryTest
|
||||
/// when no existing alarm with the same device, type, and code is found, and that the inserted alarm
|
||||
/// can subsequently be retrieved via <c>FindActiveAsync</c>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=df40b99 body=b502791 -->
|
||||
[Test]
|
||||
public async Task UpsertActiveAsync_InsertsNew()
|
||||
{
|
||||
@@ -179,6 +183,7 @@ public class PumpAlarmStateRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>RemoveAsync</c> correctly deletes an active alarm by device, alarm type, and alarm code, and that a subsequent lookup returns no result.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=7cec1b8 body=57f46a1 -->
|
||||
[Test]
|
||||
public async Task RemoveAsync_Works()
|
||||
{
|
||||
@@ -207,6 +212,7 @@ public class PumpAlarmStateRepositoryTest
|
||||
/// Verifies that the repository's <c>DeleteByPatientId</c> method successfully removes a previously upserted
|
||||
/// <see cref="PumpAlarmState"/> for the specified patient, ensuring no matching records remain in the collection.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d53a759 body=f655df6 -->
|
||||
[Test]
|
||||
public async Task DeleteByPatientId_Works()
|
||||
{
|
||||
@@ -236,6 +242,7 @@ public class PumpAlarmStateRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>FindAllActiveByDeviceAsync</c> returns only active pump alarm states that belong to the specified device.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=5c3d431 body=6ed6d8e -->
|
||||
[Test]
|
||||
public async Task FindAllActiveByDeviceAsync_ReturnsCorrect()
|
||||
{
|
||||
@@ -254,6 +261,7 @@ public class PumpAlarmStateRepositoryTest
|
||||
/// from the old ObjectId to a new ObjectId for matching documents, returning the expected count of
|
||||
/// updated records and making the document retrievable by the new ObjectId.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ed519f8 body=169b572 -->
|
||||
[Test]
|
||||
public async Task UpdateManyObjectIdByFieldNameAsync_Works()
|
||||
{
|
||||
@@ -312,6 +320,7 @@ public class PumpAlarmStateRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that UpsertActiveAsync correctly inserts a PumpAlarmState record when the AlarmCodeMdc is null, and that the record can be retrieved via FindActiveAsync using a null alarm code.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1cd185f body=08dbadd -->
|
||||
[Test]
|
||||
public async Task UpsertActiveAsync_InsertsWhenAlarmCodeIsNull()
|
||||
{
|
||||
@@ -336,6 +345,7 @@ public class PumpAlarmStateRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>RemoveAsync</c> removes every active alarm matching the specified device identifier and alarm type, not just a single record.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=e06229e body=5ac9fd3 -->
|
||||
[Test]
|
||||
public async Task RemoveAsync_RemovesAllMatching()
|
||||
{
|
||||
|
||||
@@ -192,6 +192,7 @@ public class PumpArchiveRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the <c>DeleteBeforeDate</c> repository method removes all records with a date earlier than the specified cutoff, retaining only records dated on or after that cutoff.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d3a5eeb body=b97504a -->
|
||||
[Test]
|
||||
public async Task DeleteBeforeDate()
|
||||
{
|
||||
|
||||
@@ -219,6 +219,8 @@ public class PumpObservationRepositoryTest
|
||||
/// Verifies that the aggregated last observations retrieved for the test <c>PatientId</c> are distinct by name, ensuring the resulting collection is non-empty and contains at most two entries.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=878cf7b body=9a03f04 -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=wrong_summary
|
||||
/// "The summary states the test 'verifies that the aggregated last observations... are distinct by name', but the assertions only check that the result is non-empty and has at most two entries — no distinctness-by-name check is performed." -->
|
||||
[Test]
|
||||
public async Task AggregatedPatientLastObservations_DistinctByName()
|
||||
{
|
||||
@@ -309,6 +311,8 @@ public class PumpObservationRepositoryTest
|
||||
/// Verifies that <see cref="_repo.DeleteKeepLastNAsync"/> correctly deletes the older records while preserving the most recent <paramref name="n"/> entries, returning the expected count of deleted items.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=6f857ff body=814bec4 -->
|
||||
/// <!-- aidoc-review:v1 severity=low kind=wrong_param_role
|
||||
/// "<paramref name=\"n\"/> references a parameter named 'n' but the test method DeleteKeepLastNAsync_Works has no parameters; 'n' is actually an argument passed to the called method DeleteKeepLastNAsync(3)." -->
|
||||
[Test]
|
||||
public async Task DeleteKeepLastNAsync_Works()
|
||||
{
|
||||
|
||||
@@ -35,6 +35,7 @@ public class PumpStateRepositoryTest
|
||||
/// "pump_states" MongoDB collection, building the repository indexes, and seeding two initial pump states (one
|
||||
/// actively infusing for a known patient/device and one not infusing) to verify the baseline document count.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=a2190cd -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -89,6 +90,7 @@ public class PumpStateRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that FindByDeviceIdAsync retrieves the correct infusion state for a given device, returning a non-null result that matches the requested device identifier and reflects the expected infusion status.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=e52b862 body=d7db598 -->
|
||||
[Test]
|
||||
public async Task FindByDeviceIdAsync_ReturnsCorrectState()
|
||||
{
|
||||
@@ -108,6 +110,7 @@ public class PumpStateRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>UpsertAsync</c> inserts a new <see cref="PumpState"/> record when no existing entry is found for the specified <c>DeviceId</c>, and that the persisted state retains the provided property values.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=428a2bd body=4500878 -->
|
||||
[Test]
|
||||
public async Task UpsertAsync_InsertsNewWhenNotExists()
|
||||
{
|
||||
@@ -131,6 +134,7 @@ public class PumpStateRepositoryTest
|
||||
/// the updated <see cref="PumpState"/> is persisted and retrievable with the modified <c>IsInfusing</c>,
|
||||
/// <c>Status</c>, and <c>LastUpdated</c> values.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=8838ddb body=654a229 -->
|
||||
[Test]
|
||||
public async Task UpsertAsync_UpdatesExistingState()
|
||||
{
|
||||
@@ -165,6 +169,7 @@ public class PumpStateRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>GetAllAsync</c> returns a non-null collection of pump states containing at least two entries, including those associated with the seeded devices A and B.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a469772 body=1e9a940 -->
|
||||
[Test]
|
||||
public async Task GetAllAsync_ReturnsAllStates()
|
||||
{
|
||||
@@ -190,6 +195,7 @@ public class PumpStateRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that UpsertAsync updates an existing entity instead of inserting a duplicate, ensuring the total record count remains unchanged when upserting a <see cref="PumpState"/> for an already-known device identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=0293756 body=e6aaf62 -->
|
||||
[Test]
|
||||
public async Task UpsertAsync_DoesNotCreateDuplicates()
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ public class RecordingAlertArchiveRepositoryTest
|
||||
/// <summary>
|
||||
/// One-time test setup that prepares the archive collection for recording-alert integration tests by clearing it, creating a fresh instance of <see cref="RecordingAlertArchiveRepository"/>, and seeding it with two patient recording alerts (one matching the current patient with the current timestamp and one for a different patient dated ten days earlier), verifying that both records are persisted.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=8b97155 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -69,6 +70,7 @@ public class RecordingAlertArchiveRepositoryTest
|
||||
/// Verifies that the repository's <c>DeleteBeforeDate</c> operation removes all documents dated before the specified cutoff date, leaving only documents on or after that date.
|
||||
/// Expects more than one document in the collection initially and exactly one remaining after deletion.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d3a5eeb body=b97504a -->
|
||||
[Test]
|
||||
public async Task DeleteBeforeDate()
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ public class RecordingAlertRepositoryTest
|
||||
/// One-time test setup that initializes the recording alert repository with two sample patient recording alerts
|
||||
/// and ensures the underlying collection contains exactly two documents for integration test scenarios.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=9f3c759 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -69,6 +70,7 @@ public class RecordingAlertRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's DeleteAsync method successfully removes a PatientRecordingAlert document, confirming the record exists prior to deletion and is no longer retrievable afterwards.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=fff9e82 body=bbaa167 -->
|
||||
[Test]
|
||||
public async Task DeleteAsync()
|
||||
{
|
||||
@@ -97,6 +99,7 @@ public class RecordingAlertRepositoryTest
|
||||
/// <summary>
|
||||
/// Tests that the <c>DeleteOlderDaysAsync</c> repository method removes patient recording alerts that exceed the specified age threshold and match the given recording name, while preserving alerts within the threshold.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=da9fb95 body=be75e5b -->
|
||||
[Test]
|
||||
public async Task DeleteOlderDaysAsync()
|
||||
{
|
||||
@@ -142,6 +145,7 @@ public class RecordingAlertRepositoryTest
|
||||
/// Verifies that <c>DeleteOlderNumberAsync</c> removes older records with the specified name, keeping only the most recent ones according to the provided count.
|
||||
/// Inserts two <see cref="PatientRecordingAlert"/> entries sharing the same name but different timestamps, asserts both exist, performs the deletion, and confirms that only one record remains.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=340569b body=9066da5 -->
|
||||
[Test]
|
||||
public async Task DeleteOlderNumberAsync()
|
||||
{
|
||||
@@ -180,6 +184,7 @@ public class RecordingAlertRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>DeleteByPatientId</c> removes a patient's recording alert from the repository, ensuring the alert cannot be retrieved after deletion.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=79b17ee body=abcb960 -->
|
||||
[Test]
|
||||
public async Task DeleteByPatientId()
|
||||
{
|
||||
@@ -216,6 +221,7 @@ public class RecordingAlertRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository returns a non-null result when searching for records by patient identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=3d9563b body=644ea5e -->
|
||||
[Test]
|
||||
public async Task FindByPatientIdAsync()
|
||||
{
|
||||
@@ -229,6 +235,7 @@ public class RecordingAlertRepositoryTest
|
||||
/// for a given patient and recording name, filtering out older entries based on the
|
||||
/// specified count limit, and that the returned observation matches the expected time.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=180119e body=50b755a -->
|
||||
[Test]
|
||||
public async Task FindLastObservations()
|
||||
{
|
||||
@@ -278,6 +285,7 @@ public class RecordingAlertRepositoryTest
|
||||
/// <summary>
|
||||
/// Tests the repository's ability to update the <c>patientid</c> ObjectId field across records, verifying that after the update the original patient identifier no longer returns any alerts while the new patient identifier does, and that deletion by patient ID subsequently removes the record.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ccbfce8 body=9bdadf4 -->
|
||||
[Test]
|
||||
public async Task UpdateManyObjectId()
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@ public class ServiceConfigRepositoryTest
|
||||
/// <summary>
|
||||
/// Performs one-time initialization for integration tests by creating a <see cref="ServiceConfig"/> entry in the test database and preparing the repository used by the test fixture.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=0b44aa1 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -57,6 +58,7 @@ public class ServiceConfigRepositoryTest
|
||||
/// Verifies that <see cref="_repository"/>.FindById returns a non-null entity when queried by its string identifier,
|
||||
/// and that the returned entity's <c>StrId</c> matches the supplied id.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a6c49cf body=afa730e -->
|
||||
[Test]
|
||||
public async Task FindById_Find_string()
|
||||
{
|
||||
@@ -70,6 +72,7 @@ public class ServiceConfigRepositoryTest
|
||||
/// Verifies that the repository's FindById method successfully retrieves an object by its identifier,
|
||||
/// returning a non-null result whose Id matches the requested identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=eb5b627 body=fbdee32 -->
|
||||
[Test]
|
||||
public async Task FindById_Find_ObjectId()
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ public class TreatmentArchiveRepositoryTest
|
||||
/// <summary>
|
||||
/// One-time setup method that prepares the integration test environment for the treatment archive repository by creating and inserting two sample patient treatments (one new and one discontinued) into a freshly created archive collection.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=4a90d78 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -82,6 +83,7 @@ public class TreatmentArchiveRepositoryTest
|
||||
/// Tests the <see cref="DeleteBeforeDate"/> repository method to ensure it correctly removes records older than the specified cutoff date,
|
||||
/// leaving only the most recent record. Verifies that when multiple patient records exist, deletion by date retains exactly one record.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d3a5eeb body=7124e14 -->
|
||||
[Test]
|
||||
public async Task DeleteBeforeDate()
|
||||
{
|
||||
@@ -101,6 +103,7 @@ public class TreatmentArchiveRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository successfully retrieves a non-empty collection of records associated with the specified patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=8768b4a body=58e5f0b -->
|
||||
[Test]
|
||||
public async Task FindAllFromPatient()
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@ public class TreatmentRepositoryTest
|
||||
/// <summary>
|
||||
/// One-time test setup that resets the treatments collection, instantiates the repository, and seeds two patient treatments (one with OrderControlType.Nw and one with OrderControlType.Dc) to verify insert behavior.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=d7a95ac -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -89,6 +90,7 @@ public class TreatmentRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that GetByPatientId returns an empty result collection rather than null when no patient treatments are found for the supplied patient identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=5d6b968 body=becd285 -->
|
||||
[Test]
|
||||
public async Task GetByPatientId_Not_Find_Return_Null()
|
||||
{
|
||||
@@ -103,6 +105,7 @@ public class TreatmentRepositoryTest
|
||||
/// Tests that the repository's <c>GetByPatientId</c> method returns the expected patient treatment records
|
||||
/// for the given patient, verifying that the result is not null and contains the expected number of entries.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=522d60f body=0afdfdf -->
|
||||
[Test]
|
||||
public async Task GetByPatientId_Find_Return_Null()
|
||||
{
|
||||
@@ -117,6 +120,7 @@ public class TreatmentRepositoryTest
|
||||
/// Verifies that <see cref="DeleteAsync"/> successfully removes a persisted patient treatment from the repository.
|
||||
/// The test inserts a treatment, confirms it exists, deletes it by id, and asserts it is no longer retrievable.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=fff9e82 body=fe6c727 -->
|
||||
[Test]
|
||||
public async Task DeleteAsync()
|
||||
{
|
||||
@@ -151,6 +155,7 @@ public class TreatmentRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>FindByPatientIdAsync</c> returns a non-null list containing the expected number of treatments for the specified patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=bf1a413 body=cdada4a -->
|
||||
[Test]
|
||||
public async Task FindByPatientIdAsync_Find_Return_List_Traetments()
|
||||
{
|
||||
@@ -163,6 +168,7 @@ public class TreatmentRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="DeleteByPatientId"/> removes the patient treatment associated with the given patient identifier, ensuring no records remain for that patient after deletion.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=79b17ee body=fadf697 -->
|
||||
[Test]
|
||||
public async Task DeleteByPatientId()
|
||||
{
|
||||
@@ -197,6 +203,7 @@ public class TreatmentRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that _repository.FindBolusTreatments returns a non-null collection containing exactly one bolus treatment for the specified patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dfa52bd body=9cc200d -->
|
||||
[Test]
|
||||
public async Task FindBolusTreatments_Find_Return_Treatment()
|
||||
{
|
||||
@@ -209,6 +216,7 @@ public class TreatmentRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that FindByPatientIdAsync returns a non-null list containing the expected number of treatments for the specified patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=843efa7 body=cdada4a -->
|
||||
[Test]
|
||||
public async Task FindByPatientId_Find_Return_List_Traetments()
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ public class UnitRepositoryTest
|
||||
/// <summary>
|
||||
/// One-time setup method that prepares the integration test environment by configuring API settings, creating a fresh "units" collection in the database, and seeding it with two sample <see cref="Unit"/> records via the <see cref="UnitRepository"/>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=a56e489 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -65,6 +66,7 @@ public class UnitRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that inserting a valid <see cref="Unit"/> into the repository returns the unit and that the inserted unit can be successfully retrieved by its identifier, with key properties preserved.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=9b26826 body=ddc8404 -->
|
||||
[Test]
|
||||
public async Task InsertOneUnit_ValidUnit_ReturnsUnit()
|
||||
{
|
||||
@@ -132,6 +134,7 @@ public class UnitRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that FindById retrieves the matching <see cref="Unit"/> from the repository when a valid identifier is provided.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=502c001 body=dc7d781 -->
|
||||
[Test]
|
||||
public async Task FindById_ValidId_ReturnsUnit()
|
||||
{
|
||||
@@ -157,6 +160,7 @@ public class UnitRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that FindById returns <c>null</c> when queried with an ID that does not exist in the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=eeda1b7 body=fa50971 -->
|
||||
[Test]
|
||||
public async Task FindById_InvalidId_ReturnsNull()
|
||||
{
|
||||
@@ -214,6 +218,7 @@ public class UnitRepositoryTest
|
||||
/// Verifies that the repository's <c>FindByName</c> method returns the matching unit when called with a valid unit name.
|
||||
/// The test inserts a unit, retrieves it by name, and asserts that the returned entity is not null and has the expected name.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1b153db body=e466985 -->
|
||||
[Test]
|
||||
public async Task FindByName_ValidName_ReturnsUnit()
|
||||
{
|
||||
@@ -239,6 +244,7 @@ public class UnitRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the repository's FindByName method returns null when invoked with a name that does not match any existing entity.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=bca62d2 body=2ab2e2d -->
|
||||
[Test]
|
||||
public async Task FindByName_InvalidName_ReturnsNull()
|
||||
{
|
||||
@@ -353,6 +359,7 @@ public class UnitRepositoryTest
|
||||
/// Verifies that <c>GetAll</c> returns a non-null collection containing the units that have been inserted into the repository.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentNullException">Thrown when the <c>units</c> collection used to seed the repository is <c>null</c>.</exception>
|
||||
/// <!-- aidoc:v1 sig=5b909a9 body=2d25d8f -->
|
||||
[Test]
|
||||
public async Task GetAll_ReturnsAllUnits()
|
||||
{
|
||||
@@ -381,6 +388,7 @@ public class UnitRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that UpdateUnit correctly updates an existing unit in the repository and returns the updated entity with the new title and the original identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=0c12e38 body=287b440 -->
|
||||
[Test]
|
||||
public async Task UpdateUnit_ValidUnit_ReturnsUpdatedUnit()
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@ public class UserRepositoryTest
|
||||
/// <summary>
|
||||
/// One-time integration test setup that prepares a clean "users" collection in the test database and seeds it with two predefined users, ensuring a deterministic state for downstream test cases.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81c0015 body=4cb16c2 -->
|
||||
[OneTimeSetUp]
|
||||
public async Task Init()
|
||||
{
|
||||
@@ -61,6 +62,7 @@ public class UserRepositoryTest
|
||||
/// <summary>
|
||||
/// Verifies that the <see cref="_repository"/>'s <c>GetUser</c> method asynchronously returns a non-null user with the expected username and password credentials.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=04ad7c8 body=29ee994 -->
|
||||
[Test]
|
||||
public async Task GetUser()
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace adas_core.Test.Services;
|
||||
/// <summary>
|
||||
/// Contains unit tests for verifying the behavior of the <see cref="AdmissionService"/> class.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=0c8cbc0 -->
|
||||
public class AdmissionServiceTest
|
||||
{
|
||||
private Mock<IAdmissionRepository> _admissionRepositoryMock;
|
||||
@@ -89,6 +90,7 @@ public class AdmissionServiceTest
|
||||
/// Verifies that the admission service successfully deletes a valid admission by ensuring the repository's
|
||||
/// Delete operation is invoked exactly once for the corresponding admission identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ff6349a body=41733f5 -->
|
||||
[Test]
|
||||
public async Task DeleteAdmissionAsync_ValidAdmission_DeletesSuccessfully()
|
||||
{
|
||||
@@ -109,6 +111,7 @@ public class AdmissionServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>DeleteAdmissionByIdAsync</c> successfully deletes an admission when it exists in the repository, by ensuring the repository's <c>Delete</c> method is invoked exactly once for the given admission identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ca0aebd body=1a986c5 -->
|
||||
[Test]
|
||||
public async Task DeleteAdmissionByIdAsync_AdmissionExists_DeletesSuccessfully()
|
||||
{
|
||||
@@ -131,6 +134,7 @@ public class AdmissionServiceTest
|
||||
/// associated patient location (unit, bed, and room) when the admission exists in the repository and the
|
||||
/// corresponding point of care is successfully resolved.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=8868841 body=7a047e6 -->
|
||||
[Test]
|
||||
public async Task GetAdmissionByIdAsync_AdmissionExists_ReturnsAdmissionWithPatientLocation()
|
||||
{
|
||||
@@ -160,6 +164,7 @@ public class AdmissionServiceTest
|
||||
/// Verifies that GetAdmissionsAsync returns admissions enriched with their associated patient location details
|
||||
/// retrieved from the point of care service.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=13eea4d body=5097039 -->
|
||||
[Test]
|
||||
public async Task GetAdmissionsAsync_ReturnsAdmissionsWithPatientLocations()
|
||||
{
|
||||
@@ -233,6 +238,7 @@ public class AdmissionServiceTest
|
||||
/// invoking the repository's Update method and retrieving point-of-care information for both the new and the
|
||||
/// previous point of care associated with the admission.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=947fcb9 body=5539a54 -->
|
||||
[Test]
|
||||
public async Task UpdateAdmissionAsync_WhenAdmissionExists_UpdatesAdmission()
|
||||
{
|
||||
@@ -287,6 +293,7 @@ public class AdmissionServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that admitting a patient with a valid admission—where the associated unit is found and the point of care matches—results in a new patient being inserted.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=e2d99bb body=d8e5f1d -->
|
||||
[Test]
|
||||
public async Task AdmitPatient_WithValidAdmission_CreatesPatientAndDeletesAdmission()
|
||||
{
|
||||
@@ -315,6 +322,7 @@ public class AdmissionServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that GetAdmissionByLocation returns the expected list of admissions when a matching patient location is found, confirming the service correctly retrieves results from the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1bd035d body=629b781 -->
|
||||
[Test]
|
||||
public async Task GetAdmissionByLocation_LocationExists_ReturnsAdmissions()
|
||||
{
|
||||
@@ -345,6 +353,7 @@ public class AdmissionServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="AdmissionService.GetAdmissionByLocation"/> returns an empty result when the requested location does not exist, simulating the not-found scenario by having the repository throw an exception.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=3fa7d19 body=0413056 -->
|
||||
[Test]
|
||||
public async Task GetAdmissionByLocation_LocationNotFound_ReturnsNull()
|
||||
{
|
||||
@@ -371,6 +380,7 @@ public class AdmissionServiceTest
|
||||
/// <c>GetAdmissionByPointOfCareId</c> are enriched with patient location details (unit name, bed, and room)
|
||||
/// retrieved from the corresponding Point of Care entity.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=9e8788f body=f355f5f -->
|
||||
[Test]
|
||||
public async Task GetAdmissionByPointOfCareId_POCExists_ReturnsAdmissionsWithLocation()
|
||||
{
|
||||
@@ -414,6 +424,7 @@ public class AdmissionServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="AdmissionService.GetAdmissionByPointOfCareId"/> returns an empty result when the underlying repository throws an exception while attempting to find an admission by point of care id.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=38a42b6 body=272b246 -->
|
||||
[Test]
|
||||
public async Task GetAdmissionByPointOfCareId_POCNotFound_ReturnsNull()
|
||||
{
|
||||
@@ -434,6 +445,7 @@ public class AdmissionServiceTest
|
||||
/// Verifies that <see cref="AdmissionService.GetAdmissionByUnitIdWithOutPoC"/> returns the expected list of admissions
|
||||
/// when a valid unit identifier is provided.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=991c53f body=6e3b77c -->
|
||||
[Test]
|
||||
public async Task GetAdmissionByUnitIdWithOutPoC_UnitIdExists_ReturnsAdmissions()
|
||||
{
|
||||
@@ -462,6 +474,8 @@ public class AdmissionServiceTest
|
||||
/// throws an exception while looking up the given unit identifier.
|
||||
/// </summary>
|
||||
/// <param name="unitId">The identifier of the unit whose admission record is being requested.</param>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=extra_param
|
||||
/// "The <param name=\"unitId\"> tag documents a parameter that does not exist on the test method; unitId is a local variable, not a method parameter." -->
|
||||
[Test]
|
||||
public async Task GetAdmissionByUnitIdWithOutPoC_UnitIdNotFound_ReturnsNull()
|
||||
{
|
||||
@@ -580,6 +594,7 @@ public class AdmissionServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that InsertAdmission throws a NotFoundException and performs no insert or update operations when a required associated resource is not found while processing a valid admission.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=bdfda99 body=4d28639 -->
|
||||
[Test]
|
||||
public async Task InsertAdmission_ValidAdmission_InsertsSuccessfullyWithUser()
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace adas_core.Test.Services;
|
||||
/// <summary>
|
||||
/// Contains unit tests for verifying the behavior and functionality of the <see cref="AlarmService"/> class.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=c43823a -->
|
||||
public class AlarmServiceTest
|
||||
{
|
||||
private readonly Mock<IAlarmRepository> _alarmRepositoryMock;
|
||||
@@ -121,6 +122,7 @@ public class AlarmServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that when an ORU_R40 type request is processed without any alarms, the patient is located but the observation is not persisted.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a5366da body=1b7e9c5 -->
|
||||
[Test]
|
||||
public async Task SaveRequest_Oru_R40_Type_Without_Alarms_Dont_Insert()
|
||||
{
|
||||
@@ -151,6 +153,7 @@ public class AlarmServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="AlarmService.ProcessAlarmObservations"/> inserts the provided alarm observations into the alarm repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=055d260 body=8ccc248 -->
|
||||
[Test]
|
||||
public async Task ProcessAlarmObservations_Should_Insert_Alarm_Observations()
|
||||
{
|
||||
@@ -183,6 +186,7 @@ public class AlarmServiceTest
|
||||
/// (coding system "ADAS_EVENT", description "EVT_LO and EVT_EXTR_LO"), the alarm service does not insert a new observation,
|
||||
/// as indicated by the verification that <c>InsertObservation</c> is never invoked.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=108393a body=30d7b84 -->
|
||||
[Test]
|
||||
public async Task CheckObservationAlarm_Alarm_EventPEEP_PEEP_bajo_create_Event()
|
||||
{
|
||||
@@ -211,6 +215,7 @@ public class AlarmServiceTest
|
||||
/// observation with the original value preserved (e.g., "PEEP High") while the alarm
|
||||
/// configuration handles the red beacon signaling.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=eb5bfdd body=09dd5c4 -->
|
||||
[Test]
|
||||
public async Task CheckObservationAlarm_Should_Launch_Red_Alarm_And_Set_BeaconColor_Red()
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace adas_core.Test.Services;
|
||||
/// <summary>
|
||||
/// Provides a fake implementation of the <see cref="ILockProvider"/> interface, typically used as a test double or non-functional placeholder.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=861367a -->
|
||||
public class FakeLockProvider : ILockProvider
|
||||
{
|
||||
/// <summary>
|
||||
@@ -26,11 +27,13 @@ public class FakeLockProvider : ILockProvider
|
||||
/// <param name="key">The identifier of the resource to acquire.</param>
|
||||
/// <param name="timeout">The maximum time to wait for the resource to become available.</param>
|
||||
/// <returns>A <see cref="Task{TResult}"/> that always completes with <c>true</c>, indicating the resource was acquired.</returns>
|
||||
/// <!-- aidoc:v1 sig=c012d6a -->
|
||||
public Task<bool> AcquireAsync(string key, TimeSpan timeout) => Task.FromResult(true);
|
||||
/// <summary>
|
||||
/// Releases the resource associated with the specified key. This implementation completes immediately without performing any additional operation.
|
||||
/// </summary>
|
||||
/// <param name="key">The identifier of the resource to release.</param>
|
||||
/// <!-- aidoc:v1 sig=34ce6e6 -->
|
||||
public Task ReleaseAsync(string key) => Task.CompletedTask;
|
||||
}
|
||||
|
||||
@@ -40,6 +43,7 @@ public class FakeLockProvider : ILockProvider
|
||||
/// <remarks>
|
||||
/// Inherits all members from <see cref="LockManagerService"/> and is intended to be used in place of the real service when actual locking functionality is not required.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=912ee25 -->
|
||||
public class FakeLockManagerService : LockManagerService
|
||||
{
|
||||
/// <summary>
|
||||
@@ -60,6 +64,7 @@ public class FakeLockManagerService : LockManagerService
|
||||
/// <remarks>
|
||||
/// This class combines the inheritance of <see cref="RedisService"/> with the contract of <see cref="ICacheService"/>, allowing it to stand in for a real Redis-backed cache during unit tests or development.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=8effc11 -->
|
||||
public class FakeRedisService : RedisService, ICacheService
|
||||
{
|
||||
public bool WasCalled { get; private set; }
|
||||
@@ -86,6 +91,7 @@ public class FakeRedisService : RedisService, ICacheService
|
||||
/// <param name="ttl">An optional time-to-live duration for the cached entry. Not used in this implementation.</param>
|
||||
/// <param name="cancellationToken">A token to observe for cancellation requests. Not used in this implementation.</param>
|
||||
/// <returns>A task that represents the asynchronous operation, containing the object produced by the factory.</returns>
|
||||
/// <!-- aidoc:v1 sig=f7027e3 body=b366c2a -->
|
||||
Task<T> ICacheService.GetOrSetObjectAsync<T>(
|
||||
string key,
|
||||
Func<Task<T>> factory,
|
||||
@@ -107,6 +113,7 @@ public class FakeRedisService : RedisService, ICacheService
|
||||
/// <param name="ttl">An optional time-to-live duration for the cached entry.</param>
|
||||
/// <param name="cancellationToken">The token used to cancel the asynchronous operation.</param>
|
||||
/// <returns>The value of type <typeparamref name="T"/> produced by the <paramref name="factory"/> delegate.</returns>
|
||||
/// <!-- aidoc:v1 sig=efeef03 body=0bb8f50 -->
|
||||
Task<T> ICacheService.GetOrSetObjectAsync<T>(
|
||||
GroupedField groupedField,
|
||||
ObjectId patientId,
|
||||
@@ -126,6 +133,7 @@ public class FakeRedisService : RedisService, ICacheService
|
||||
/// <remarks>
|
||||
/// This class combines inheritance from the concrete <see cref="CacheService"/> base class with the <see cref="ICacheService"/> contract, allowing it to be used wherever an <see cref="ICacheService"/> is required.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=db2971f -->
|
||||
public class FakeCacheService : CacheService, ICacheService
|
||||
{
|
||||
public bool WasCalled { get; private set; }
|
||||
@@ -148,6 +156,15 @@ public class FakeCacheService : CacheService, ICacheService
|
||||
/// <param name="cancellationToken">Token to cancel the operation; ignored by this implementation.</param>
|
||||
/// <returns>The <see cref="Task{T}"/> produced by invoking <paramref name="factory"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=f7027e3 body=b366c2a -->
|
||||
/// <summary>
|
||||
/// Explicit <see cref="ICacheService"/> implementation that always invokes <paramref name="factory"/> and ignores <paramref name="ttl"/> and <paramref name="cancellationToken"/>, effectively bypassing the cache and returning the value freshly produced for the supplied <paramref name="key"/>.
|
||||
/// </summary>
|
||||
/// <param name="key">The cache key identifying the requested entry.</param>
|
||||
/// <param name="factory">The asynchronous delegate invoked to produce the value.</param>
|
||||
/// <param name="ttl">The optional cache lifetime. Not applied by this implementation.</param>
|
||||
/// <param name="cancellationToken">The token used to cancel the operation. Not observed by this implementation.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that completes with the value returned by <paramref name="factory"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=f7027e3 body=b366c2a -->
|
||||
Task<T> ICacheService.GetOrSetObjectAsync<T>(
|
||||
string key,
|
||||
Func<Task<T>> factory,
|
||||
@@ -170,6 +187,18 @@ public class FakeCacheService : CacheService, ICacheService
|
||||
/// <param name="cancellationToken">A <see cref="CancellationToken"/> to cancel the operation.</param>
|
||||
/// <returns>A <see cref="Task{T}"/> that resolves to the value returned by <paramref name="factory"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=efeef03 body=0bb8f50 -->
|
||||
/// <summary>
|
||||
/// Test implementation of <see cref="ICacheService.GetOrSetObjectAsync{T}"/> that bypasses caching
|
||||
/// and directly invokes the supplied <paramref name="factory"/> delegate, recording the call via the
|
||||
/// WasCalled flag for verification purposes.
|
||||
/// </summary>
|
||||
/// <param name="groupedField">The <see cref="GroupedField"/> identifying the group context for the cached or computed object.</param>
|
||||
/// <param name="patientId">The <see cref="ObjectId"/> of the patient whose data is being retrieved.</param>
|
||||
/// <param name="factory">The <see cref="Func{Task{T}}"/> delegate invoked to produce the result.</param>
|
||||
/// <param name="ttl">Optional time-to-live duration; ignored by this implementation.</param>
|
||||
/// <param name="cancellationToken">Token to observe for cancellation; ignored by this implementation.</param>
|
||||
/// <returns>The <see cref="Task{T}"/> produced by invoking <paramref name="factory"/>.</returns>
|
||||
/// <!-- aidoc:v1 sig=efeef03 body=0bb8f50 -->
|
||||
Task<T> ICacheService.GetOrSetObjectAsync<T>(
|
||||
GroupedField groupedField,
|
||||
ObjectId patientId,
|
||||
@@ -189,6 +218,7 @@ public class FakeCacheService : CacheService, ICacheService
|
||||
/// <remarks>
|
||||
/// This class inherits from <see cref="NoCacheService"/> and implements the <see cref="ICacheService"/> interface, providing a non-functional cache suitable for unit tests or environments where caching should be bypassed.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=801fd16 -->
|
||||
public class FakeNoCacheService : NoCacheService, ICacheService
|
||||
{
|
||||
public bool WasCalled { get; private set; }
|
||||
@@ -234,6 +264,7 @@ public class CacheDispatcherTest
|
||||
/// <summary>
|
||||
/// Initializes the test environment by instantiating fake implementations of the Redis, in-memory, and no-op cache services, along with default <see cref="CacheSettings"/>, and constructs a <see cref="CacheDispatcher"/> under test using these dependencies.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d8eb19f body=9827af1 -->
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
@@ -358,6 +389,7 @@ public class CacheDispatcherTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="CacheKeyClassifier.Classify"/> returns <see cref="CacheEnum.EntityType.Unknown"/> when the provided cache key does not start with any recognized prefix.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=60a34b6 body=6a7aecd -->
|
||||
[Test]
|
||||
public void Classify_ReturnsUnknown_ForUnrecognizedPrefix()
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@ public class CacheServiceTest
|
||||
/// Initializes the test environment by creating a <see cref="LockManagerService"/> with a mock logger
|
||||
/// and an in-memory lock provider, and instantiating the <see cref="CacheService"/> under test with that lock manager.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d8eb19f body=0002dc3 -->
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
@@ -55,6 +56,7 @@ public class CacheServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>GetOrSetObjectAsync</c> invokes the supplied factory on the first call, persists the produced value, and on subsequent calls returns the cached value without invoking the factory again.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=9730504 body=5d35764 -->
|
||||
[Test]
|
||||
public async Task GetOrSetObjectAsync_InvokesFactory_StoresResult_AndDoesNotInvokeAgainOnSecondCall()
|
||||
{
|
||||
@@ -89,6 +91,7 @@ public class CacheServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>GetOrSetObjectAsync</c> does not cache <see langword="null"/> results, ensuring the factory delegate is re-invoked on subsequent calls for the same key when the previously produced value was <see langword="null"/>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=bb0d5c2 body=179c9ee -->
|
||||
[Test]
|
||||
public async Task GetOrSetObjectAsync_DoesNotCacheNullResult_AndInvokesFactoryOnSubsequentCalls()
|
||||
{
|
||||
@@ -118,6 +121,7 @@ public class CacheServiceTest
|
||||
/// the second thread does not invoke its factory if the first thread has already inserted the value,
|
||||
/// and both threads receive the value produced by the first thread's factory.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=6a067fe body=858fc91 -->
|
||||
[Test]
|
||||
public async Task GetOrSetObjectAsync_SecondCheckInLock_PreventsFactoryExecution_WhenValueAlreadyInsertedByFirstThread()
|
||||
{
|
||||
@@ -161,6 +165,7 @@ public class CacheServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that calling <c>DeleteObjectAsync</c> removes the stored value for the given key, and that the next call to <c>GetOrSetObjectAsync</c> invokes the factory delegate to produce a new value instead of returning a previously cached one.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=c88be79 body=aaf8770 -->
|
||||
[Test]
|
||||
public async Task DeleteObjectAsync_RemovesKey_AndFactoryIsInvokedOnNextCall()
|
||||
{
|
||||
@@ -188,6 +193,7 @@ public class CacheServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>DeleteByPatternAsync</c> removes only the cache entries whose keys match the supplied pattern while preserving unrelated keys that do not match.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=395241c body=7523f89 -->
|
||||
[Test]
|
||||
public async Task DeleteByPatternAsync_RemovesMatchingKeys_AndKeepsNonMatchingKeys()
|
||||
{
|
||||
@@ -214,6 +220,7 @@ public class CacheServiceTest
|
||||
/// Verifies that <c>CleanCache</c> removes all entries from the cache, causing subsequent
|
||||
/// <c>GetOrSetObjectAsync</c> calls to invoke the provided factory delegate to repopulate the value.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=3336c2b body=de2514b -->
|
||||
[Test]
|
||||
public async Task CleanCache_RemovesAllKeys_AndFactoryIsInvokedAfterClean()
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@ internal class CameraServiceTest
|
||||
/// <summary>
|
||||
/// NUnit <see cref="SetUpAttribute"/> method executed before each test to initialize shared test state, such as camera configuration dictionaries, mocked camera and logger services, and a mocked subscribers service. Currently all initialization logic is commented out, so the method performs no setup actions.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=4448e1d -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -50,6 +51,8 @@ internal class CameraServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the <c>MaskStream</c> operation on the camera service returns a valid response when invoked with activation and coordinate parameters against the configured camera settings. Covers the scenario where the underlying grab response is null, ensuring the service still produces a non-null response with the expected status code and content.
|
||||
/// </summary>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=stale_summary
|
||||
/// "The entire method body is commented out, so no verification, assertions, or behavior described in the summary actually executes; the test has been effectively removed." -->
|
||||
public void MaskStream_Return_Ok()
|
||||
{
|
||||
//bool activate = true;
|
||||
|
||||
@@ -83,6 +83,7 @@ public class ConfigObservationServiceTest
|
||||
/// Configures a default authenticated <see cref="ClaimsPrincipal"/> in the HTTP context and sets the cache mocks to bypass caching by executing the factory function directly,
|
||||
/// ensuring repository calls are invoked during tests.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=baa71ba -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -144,6 +145,8 @@ public class ConfigObservationServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that querying a patient observation by <c>CodingSystem</c> only, without specifying a code or name, returns a null result.
|
||||
/// </summary>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary states the query is performed 'without specifying a code or name', but the test code explicitly sets Code = \"Pump_X\" and Name = \"Alarm_Pump_X\" on the PatientObservation before calling _service.Get(obs)." -->
|
||||
[Test]
|
||||
public async Task Get_config_observation_item_by_codingSystem_only_return_null()
|
||||
{
|
||||
@@ -163,6 +166,7 @@ public class ConfigObservationServiceTest
|
||||
/// Verifies that <c>Get</c> returns the matching patient observation configuration for a given observation identified by its code and coding system.
|
||||
/// Asserts that the resolved item is not null and that the displayed name is mapped from the configured lookup to the expected localized value.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d32a79d body=97b6327 -->
|
||||
[Test]
|
||||
public async Task Get_config_observation_item_by_code_and_codingSystem()
|
||||
{
|
||||
@@ -186,6 +190,7 @@ public class ConfigObservationServiceTest
|
||||
/// matching the requested observation against the list returned by the repository and returning
|
||||
/// the item with the expected name.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=3d7c0ca body=615f166 -->
|
||||
[Test]
|
||||
public async Task Get_config_observation_item_by_name()
|
||||
{
|
||||
@@ -201,6 +206,7 @@ public class ConfigObservationServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the service returns null when a patient observation item is requested by a name that does not exist in the configuration list.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=fa14228 body=beae3aa -->
|
||||
[Test]
|
||||
public async Task Get_config_observation_item_by_name_not_exist_returns_null()
|
||||
{
|
||||
@@ -216,6 +222,7 @@ public class ConfigObservationServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the service retrieves the correct configuration by matching both the observation code with its coding system and the parent data code with its coding system, returning the configuration named "ph".
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2711221 body=baf8942 -->
|
||||
[Test]
|
||||
public async Task Get_config_by_code_and_parent()
|
||||
{
|
||||
@@ -241,6 +248,7 @@ public class ConfigObservationServiceTest
|
||||
/// Verifies that the mapping service returns <c>null</c> when the observation name is unknown
|
||||
/// and the configuration is set to ignore unknown observations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b604759 body=1c3599d -->
|
||||
[Test]
|
||||
public async Task Map_unknown_ignore_true_returns_null()
|
||||
{
|
||||
@@ -257,6 +265,7 @@ public class ConfigObservationServiceTest
|
||||
/// the <c>Map</c> method returns the original observation as-is when no matching record is found
|
||||
/// in the repository, rather than discarding it as an unknown observation.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=bb05709 body=c204c4b -->
|
||||
[Test]
|
||||
public async Task Map_unknown_ignore_false_returns_obs()
|
||||
{
|
||||
@@ -273,6 +282,7 @@ public class ConfigObservationServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that mapping a patient observation with a value of 14 results in an "Ok" status, confirming the threshold mapping logic returns the expected outcome.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=81e9217 body=d5f8b5a -->
|
||||
[Test]
|
||||
public async Task Map_threshold_Ok()
|
||||
{
|
||||
@@ -293,6 +303,7 @@ public class ConfigObservationServiceTest
|
||||
/// <summary>
|
||||
/// Tests that the Map method returns a Warning status when a patient observation value exceeds the configured threshold.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=62b87c5 body=8312d29 -->
|
||||
[Test]
|
||||
public async Task Map_threshold_Warning()
|
||||
{
|
||||
@@ -313,6 +324,7 @@ public class ConfigObservationServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that mapping a <see cref="PatientObservation"/> with a SOFA score of 9 through the configured service results in a result with an <see cref="StatusEnum.Type.Alert"/> status.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b9d47f9 body=ff5f81e -->
|
||||
[Test]
|
||||
public async Task Map_threshold_Alert()
|
||||
{
|
||||
@@ -334,6 +346,7 @@ public class ConfigObservationServiceTest
|
||||
/// Verifies that mapping a parent <see cref="PatientObservation"/> returns an <see cref="StatusEnum.Type.Ok"/> status
|
||||
/// when the repository successfully locates the configuration by identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ba42824 body=c7bbf55 -->
|
||||
[Test]
|
||||
public async Task Map_parent_ok()
|
||||
{
|
||||
@@ -354,6 +367,7 @@ public class ConfigObservationServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>UpdateConfig</c> successfully updates an existing configuration and returns the updated <see cref="ConfigObservation"/> with the new name.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=18d4b11 body=f7f80a4 -->
|
||||
[Test]
|
||||
public async Task UpdateConfig_ok()
|
||||
{
|
||||
@@ -376,6 +390,7 @@ public class ConfigObservationServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>UpdateConfig</c> throws a <see cref="NotFoundException"/> when the target <c>ConfigObservation</c> cannot be found by its identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=470341f body=33e9665 -->
|
||||
[Test]
|
||||
public async Task UpdateConfig_notfound()
|
||||
{
|
||||
@@ -392,6 +407,7 @@ public class ConfigObservationServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the <c>CreateConfig</c> service method successfully inserts the provided configuration and returns the expected result.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=4c4fb2f body=19b37b8 -->
|
||||
[Test]
|
||||
public async Task CreateConfig_ok()
|
||||
{
|
||||
@@ -405,6 +421,7 @@ public class ConfigObservationServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="BadRequestException"/> is thrown when attempting to create a configuration that already exists.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ea4710c body=04477ed -->
|
||||
[Test]
|
||||
public void CreateConfig_duplicate_throws()
|
||||
{
|
||||
@@ -420,6 +437,7 @@ public class ConfigObservationServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that RemoveConfigItem successfully removes a configuration item and returns the deleted entity when the repository finds and deletes it.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=30c283f body=7951323 -->
|
||||
[Test]
|
||||
public async Task RemoveConfigItem_ok()
|
||||
{
|
||||
@@ -436,6 +454,7 @@ public class ConfigObservationServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>RemoveConfigItem</c> returns <c>null</c> when the underlying delete operation on the repository yields no result, simulating the case where the configuration item does not exist.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=87b0794 body=76439aa -->
|
||||
[Test]
|
||||
public async Task RemoveConfigItem_null()
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@ public class ConfigPumpsServiceTest
|
||||
/// <summary>
|
||||
/// Initializes the test environment by creating mock dependencies and instantiating the <see cref="ConfigPumpsService"/> under test.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=4e72b76 -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -72,6 +73,7 @@ public class ConfigPumpsServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the <see cref="ConfigPumpsService.Map"/> method returns the same <see cref="PumpObservation"/> instance unchanged when the <c>ConfigPumpsRequired</c> option is set to <c>false</c>, bypassing any pump configuration lookup or transformation.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1d5bff3 body=48fe32c -->
|
||||
[Test]
|
||||
public async Task Map_configPumpsRequired_false_Return_same_pump()
|
||||
{
|
||||
@@ -100,6 +102,7 @@ public class ConfigPumpsServiceTest
|
||||
/// Verifies that when pump configuration is required and the pump has no alarm type,
|
||||
/// the <c>Map</c> method returns the same pump instance unchanged.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=3192070 body=bd61ede -->
|
||||
[Test]
|
||||
public async Task Map_not_alarmType_Return_same_pump()
|
||||
{
|
||||
@@ -120,6 +123,7 @@ public class ConfigPumpsServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the <see cref="ConfigPumpsService.Map"/> method returns the original <see cref="PumpObservation"/> unchanged when the configuration pump item is empty, ensuring that no <c>UiConfiguration</c> is assigned in that case.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=8a185e9 body=db91573 -->
|
||||
[Test]
|
||||
public async Task Map_Not_uiConfiguration_Return_same_pump()
|
||||
{
|
||||
@@ -156,6 +160,7 @@ public class ConfigPumpsServiceTest
|
||||
/// alarm type, ensuring the resulting UI configuration contains the expected label
|
||||
/// entries such as the "screenAlarmLabel" mapped to the alarm type.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=585a146 body=115a9b0 -->
|
||||
[Test]
|
||||
public async Task Map_uiConfiguration_Return_pump_uiConfiguration()
|
||||
{
|
||||
|
||||
@@ -20,6 +20,7 @@ public class ConfigUnitsServiceTest
|
||||
/// <summary>
|
||||
/// Initializes the test dependencies and creates a new instance of <see cref="ConfigUnitsService"/> with mocked repository, options, and logger for use in unit tests.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=f4122ef -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -58,6 +59,7 @@ public class ConfigUnitsServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that when <c>ConfigUnitsRequired</c> is set to <c>false</c>, the <see cref="ConfigUnitsService.Map"/> method returns the same observation instance without applying any unit mapping or transformation.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=bab3791 body=d6d820f -->
|
||||
[Test]
|
||||
public async Task Map_configUnitsRequired_false_Return_same_obs()
|
||||
{
|
||||
@@ -84,6 +86,7 @@ public class ConfigUnitsServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that mapping a patient observation that does not contain units returns the same observation unchanged, confirming the mapping logic preserves the original data when no unit conversion is applicable.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=fc6d0dc body=239be85 -->
|
||||
[Test]
|
||||
public async Task Map_not_units_Return_same_obs()
|
||||
{
|
||||
@@ -105,6 +108,7 @@ public class ConfigUnitsServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the Map method returns the original observation unchanged with a null Units property when configuration units are required and no matching config unit is found for the observation's code.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=7e98721 body=91ddc62 -->
|
||||
[Test]
|
||||
public async Task Map_Not_Find_Config_Return_same_obs()
|
||||
{
|
||||
@@ -140,6 +144,7 @@ public class ConfigUnitsServiceTest
|
||||
/// Verifies that Map returns the configured unit value for a patient observation when
|
||||
/// ConfigUnitsRequired is enabled and a matching config unit is found in the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f7a66e6 body=4f13f04 -->
|
||||
[Test]
|
||||
public async Task Map_configUnits_Return_obs_ConfigUnit()
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@ public class DiagnosisServiceTest
|
||||
/// <summary>
|
||||
/// Initializes the mocked dependencies (patient, diagnosis, unit, audit, subscribers and calculated observations services along with their repositories) and constructs the <see cref="DiagnosisService"/> instance under test.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=00b1d4d -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -148,6 +149,7 @@ public class DiagnosisServiceTest
|
||||
/// Verifies that <c>SaveRequest</c> does not insert a diagnosis when the patient referenced by the <see cref="ApiRequest"/> cannot be found.
|
||||
/// </summary>
|
||||
/// <returns>A task representing the asynchronous test execution.</returns>
|
||||
/// <!-- aidoc:v1 sig=8c3ffda body=ba42756 -->
|
||||
[Test]
|
||||
public async Task SaveRequest_Not_FindPatient_Return_not_insert()
|
||||
{
|
||||
@@ -172,6 +174,12 @@ public class DiagnosisServiceTest
|
||||
/// </summary>
|
||||
/// <param name="apiRequest">The API request containing the patient and observation data being evaluated.</param>
|
||||
/// <param name="null">Reserved parameter passed to <c>SaveRequest</c> as a null value.</param>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary states SaveRequest is invoked when the ApiRequest is 'not considered an observation request', but the test setup explicitly populates ObservationData (Code, CodingSystem, Value, Text, Time)." -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=stale_summary
|
||||
/// "The summary claims 'observations must be present to trigger a database insertion', yet the test contains a fully populated ObservationData and still expects InsertOneAsync to never be called." -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=extra_param
|
||||
/// "The test method takes no parameters, but the documentation declares <param name='apiRequest'> and <param name='null'>, describing arguments passed to SaveRequest rather than test parameters." -->
|
||||
[Test]
|
||||
public async Task SaveRequest_Not_Observations_Return_not_insert()
|
||||
{
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace adas_core.Test.Services;
|
||||
/// <summary>
|
||||
/// Provides unit tests for the <see cref="DischargeService"/> class, verifying the behavior and correctness of discharge-related operations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=400fd1a -->
|
||||
public class DischargeServiceTest
|
||||
{
|
||||
private readonly Mock<ILocalAuditService> _auditServiceMock = new();
|
||||
@@ -34,6 +35,7 @@ public class DischargeServiceTest
|
||||
/// <summary>
|
||||
/// Sets up the test environment by creating a mock authenticated user context and instantiating the <see cref="DischargeService"/> with its required dependencies for use in unit tests.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=c3b979f -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -66,6 +68,8 @@ public class DischargeServiceTest
|
||||
/// when it exists in the repository.
|
||||
/// </summary>
|
||||
/// <param name="discharge">The discharge entity expected to be deleted; its identifier is used to invoke the repository delete operation.</param>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=extra_param
|
||||
/// "The test method takes no parameters, but the documentation includes a <param name=\"discharge\"> tag. The discharge is an argument passed to the production method being tested, not a parameter of the test itself." -->
|
||||
[Test]
|
||||
public async Task DeleteDischargeAsync_WhenDischargeExists_DeletesDischarge()
|
||||
{
|
||||
@@ -100,6 +104,7 @@ public class DischargeServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="DischargeService.GetDischargeByIdAsync"/> throws a <see cref="NotFoundException"/> when the requested discharge is not found.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=52f2a9a body=86f9d19 -->
|
||||
[Test]
|
||||
public void GetDischargeByIdAsync_WhenExceptionOccurs_ReturnsNullAndLogsError()
|
||||
{
|
||||
@@ -114,6 +119,7 @@ public class DischargeServiceTest
|
||||
/// Verifies that the discharge service returns the expected discharges retrieved from the repository when the underlying repository call completes successfully without exceptions.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="Task"/> representing the asynchronous test execution.</returns>
|
||||
/// <!-- aidoc:v1 sig=11f6fa6 body=746f877 -->
|
||||
[Test]
|
||||
public async Task GetDischargesAsync_WhenNoException_ReturnsDischarges()
|
||||
{
|
||||
@@ -150,6 +156,7 @@ public class DischargeServiceTest
|
||||
/// Verifies that <see cref="DischargeService.InsertDischarge"/> returns the inserted discharge
|
||||
/// when the underlying repository successfully completes the insertion and the entity can be retrieved by its identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f69e0b9 body=aed5a93 -->
|
||||
[Test]
|
||||
public async Task InsertDischarge_WhenInsertionSuccessful_ReturnsInsertedDischarge()
|
||||
{
|
||||
@@ -169,6 +176,7 @@ public class DischargeServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="DischargeService.InsertDischarge"/> handles repository insertion failures by propagating the exception thrown by the underlying data store.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b44150e body=8660eb8 -->
|
||||
[Test]
|
||||
public void InsertDischarge_WhenInsertionFails_ReturnsNullAndLogsError()
|
||||
{
|
||||
@@ -186,6 +194,7 @@ public class DischargeServiceTest
|
||||
/// Verifies that <see cref="DischargeService.GetDischargeByLocation"/> returns the discharge
|
||||
/// retrieved from the repository when a discharge exists for the specified patient location.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a7b4f8b body=70251df -->
|
||||
[Test]
|
||||
public async Task GetDischargeByLocation_WhenDischargeExists_ReturnsDischarge()
|
||||
{
|
||||
@@ -204,6 +213,7 @@ public class DischargeServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="IDischargeService.GetDischargeByLocation"/> returns <c>null</c> when the underlying discharge repository throws an exception while retrieving the discharge record for the specified patient location.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2531264 body=4379b10 -->
|
||||
[Test]
|
||||
public async Task GetDischargeByLocation_WhenExceptionOccurs_ReturnsNullAndLogsError()
|
||||
{
|
||||
@@ -236,6 +246,7 @@ public class DischargeServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="DischargeService.GetDischargeByPointOfCareId"/> returns <c>null</c> when the underlying repository throws an exception while attempting to retrieve a discharge by its point-of-care identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=3c82b56 body=9141fcb -->
|
||||
[Test]
|
||||
public async Task GetDischargeByPointOfCareId_WhenExceptionOccurs_ReturnsNullAndLogsError()
|
||||
{
|
||||
|
||||
@@ -46,6 +46,7 @@ public class DisplayServiceTest
|
||||
/// Initializes mocked dependencies and configuration required to construct a <see cref="DisplayService"/> instance for unit tests.
|
||||
/// Sets up the HTTP context with a test user claim, creates default cache settings, and wires all collaborators (repositories, services, logger, permissions) into the service under test.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d8eb19f body=d0144e9 -->
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
@@ -93,6 +94,7 @@ public class DisplayServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="DisplayService.InsertOne"/> inserts a display by resolving the default configuration for its type and persisting it through the repository's insert method.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=8846ed1 body=36d74d2 -->
|
||||
[Test]
|
||||
public async Task InsertOne_ShouldInsertDisplay()
|
||||
{
|
||||
@@ -121,6 +123,7 @@ public class DisplayServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the <see cref="DisplayService"/> returns the expected <see cref="Display"/> instance when a matching id is provided through the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a7045b7 body=3124a14 -->
|
||||
[Test]
|
||||
public async Task GetById_ShouldReturnDisplay()
|
||||
{
|
||||
@@ -140,6 +143,7 @@ public class DisplayServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that _displayService.GetAllByUser returns an empty collection when the user name is null.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=67b03d0 body=cceeae1 -->
|
||||
[Test]
|
||||
public async Task GetAllByUser_ShouldReturnEmpty_WhenUserNameNull()
|
||||
{
|
||||
@@ -238,6 +242,7 @@ public class DisplayServiceTest
|
||||
/// from the display repository, ensuring the service correctly resolves configurations and
|
||||
/// their linked displays for the given display type.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=5eccacf body=8683226 -->
|
||||
[Test]
|
||||
public async Task GetByType_ShouldReturnDisplays()
|
||||
{
|
||||
@@ -261,6 +266,7 @@ public class DisplayServiceTest
|
||||
/// Verifies that <see cref="DisplayService.GetByType"/> returns an empty collection when no display configurations are found for the specified display type.
|
||||
/// </summary>
|
||||
/// <returns>A task that completes when the assertion confirming the empty result has been executed.</returns>
|
||||
/// <!-- aidoc:v1 sig=b325f8a body=dccb49c -->
|
||||
[Test]
|
||||
public async Task GetByType_ShouldReturnEmpty_WhenNoConfigsFound()
|
||||
{
|
||||
@@ -280,6 +286,8 @@ public class DisplayServiceTest
|
||||
/// </summary>
|
||||
/// <param name="poc">The point of care used to look up associated displays.</param>
|
||||
/// <returns>A task representing the asynchronous test execution.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=extra_param
|
||||
/// "The <param name=\"poc\"> tag documents a parameter that does not exist on the test method (which takes no arguments)." -->
|
||||
[Test]
|
||||
public async Task GetByPointOfCare_ShouldReturnDisplays()
|
||||
{
|
||||
@@ -301,6 +309,7 @@ public class DisplayServiceTest
|
||||
/// Verifies that <see cref="DisplayService.GetByConfigId"/> returns the displays associated with the specified configuration ID retrieved from the repository.
|
||||
/// </summary>
|
||||
/// <returns>A task that completes when the assertion confirms the returned collection contains the expected number of displays.</returns>
|
||||
/// <!-- aidoc:v1 sig=0344410 body=2a414ec -->
|
||||
[Test]
|
||||
public async Task GetByConfigId_ShouldReturnDisplays()
|
||||
{
|
||||
@@ -321,6 +330,7 @@ public class DisplayServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the <see cref="DisplayService.GetByName"/> method throws a <see cref="NotFoundException"/> when no display matching the specified name is found in the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=9366b2d body=7fc914f -->
|
||||
[Test]
|
||||
public void GetByName_ShouldThrow_WhenNotFound()
|
||||
{
|
||||
@@ -337,6 +347,7 @@ public class DisplayServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>GetInfo</c> returns a <see cref="Display"/> with its associated <c>PointOfCare</c> entries populated when invoked with the "with POC" flag enabled and a valid display identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=0097b05 body=1dea72f -->
|
||||
[Test]
|
||||
public async Task GetInfo_ShouldReturnDisplayWithPoc()
|
||||
{
|
||||
@@ -381,6 +392,7 @@ public class DisplayServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="IDisplayService.GetByUnitId"/> returns the displays associated with the specified unit identifier when the repository contains matching records.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2c9de1f body=4dae710 -->
|
||||
[Test]
|
||||
public async Task GetByUnitId_ShouldReturnDisplays()
|
||||
{
|
||||
@@ -402,6 +414,7 @@ public class DisplayServiceTest
|
||||
/// Verifies that UpdatePointOfCareList throws a <see cref="NotFoundException"/> when the display with the specified identifier does not exist.
|
||||
/// </summary>
|
||||
/// <exception cref="NotFoundException">Thrown when no display is found for the given id.</exception>
|
||||
/// <!-- aidoc:v1 sig=fe05ec6 body=46f08a3 -->
|
||||
[Test]
|
||||
public void UpdatePointOfCareList_ShouldThrow_WhenDisplayNotFound()
|
||||
{
|
||||
@@ -422,6 +435,8 @@ public class DisplayServiceTest
|
||||
/// </summary>
|
||||
/// <param name="id">The unique identifier of the display whose configuration preset is being updated.</param>
|
||||
/// <param name="cfgId">The unique identifier of the configuration preset to associate with the display.</param>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=extra_param
|
||||
/// "The method has no parameters; 'id' and 'cfgId' are local variables, not method parameters, so the <param> tags document non-existent parameters." -->
|
||||
[Test]
|
||||
public void UpdateConfigPreset_ShouldThrow_WhenUpdateFails()
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@ public class GroupedObservationServiceTest
|
||||
/// (configuration observation service, observation repository, logger, and cache service)
|
||||
/// and instantiating the <see cref="GroupedObservationService"/> under test with default API and cache settings.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=681afdf -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -46,6 +47,7 @@ public class GroupedObservationServiceTest
|
||||
/// verifying the distribution of observations across shifts for the current day, the previous day, and two days prior when the
|
||||
/// Result.Last aggregation is applied with a maximum count of 36.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=49572e1 body=ce7d966 -->
|
||||
[Test]
|
||||
public void Generate_Shift_Observations()
|
||||
{
|
||||
@@ -101,6 +103,7 @@ public class GroupedObservationServiceTest
|
||||
/// the current day, the previous day, and two days prior, ensuring that data is aggregated into the
|
||||
/// correct shift and day buckets.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d4b4f96 body=5a17087 -->
|
||||
[Test]
|
||||
public void Calculate_Shift_Observations()
|
||||
{
|
||||
@@ -248,6 +251,7 @@ public class GroupedObservationServiceTest
|
||||
/// so that the returned sequence contains a complete set of five consecutive hourly observations
|
||||
/// (covering the last five hours relative to the current time) for a group with hourly regularity and a maximum of five entries.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=667f3ff body=a77fd75 -->
|
||||
[Test]
|
||||
public async Task Calculate_Last_Filled_Observations_should_add_Minus_4_hour_to_complete_last_five_hours()
|
||||
{
|
||||
@@ -303,6 +307,7 @@ public class GroupedObservationServiceTest
|
||||
/// adding the <c>-1 hour</c> observation when it is not present in the provided list so that the returned
|
||||
/// collection always contains a complete five-hour window of last filled observations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f2c5b12 body=9dbcc21 -->
|
||||
[Test]
|
||||
public async Task Calculate_Last_Filled_Observations_should_add_Minus_1_hour_to_complete_last_five_hours()
|
||||
{
|
||||
@@ -356,6 +361,7 @@ public class GroupedObservationServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the service correctly fills hourly observations from half-hour observation data, grouping timestamped values by hour and forwarding missing slots up to the configured maximum (5) per hour.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=381b258 body=ed397dd -->
|
||||
[Test]
|
||||
public void FillHoursObservations()
|
||||
{
|
||||
@@ -486,6 +492,7 @@ public class GroupedObservationServiceTest
|
||||
/// <param name="resultType">The result type that determines how the value is stored; aggregate types (HalfHour, Sum, Count, Min, Average, Max) are stored directly, while others are wrapped in a sub-document with time and stringified value.</param>
|
||||
/// <param name="all">Optional BsonArray of additional entries; when provided, it is appended to the result under the "all" key.</param>
|
||||
/// <returns>A BsonDocument containing the _id composite key, a time field, the result-type-specific payload, and optionally the "all" array.</returns>
|
||||
/// <!-- aidoc:v1 sig=e94c5ea body=f4284ca -->
|
||||
private static BsonDocument GenerateBsonDocument(int? year, int? month, int? day, int? hour, int? minute,
|
||||
string name, object value, Result resultType, BsonArray? all)
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ internal class HistoricalConfigChangesServiceTest
|
||||
/// <summary>
|
||||
/// Initializes the mock repository, mock logger, and the <see cref="HistoricalConfigChangesService"/> instance under test prior to each unit test execution.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=f227270 -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -44,6 +45,8 @@ internal class HistoricalConfigChangesServiceTest
|
||||
/// </summary>
|
||||
/// <param name="configType">The type of configuration whose last historical changes are being retrieved.</param>
|
||||
/// <returns>A task that represents the asynchronous test execution.</returns>
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=extra_param
|
||||
/// "The test method has no parameters, but the documentation includes a <param> tag for 'configType', which is actually a local variable, not a method parameter." -->
|
||||
[Test]
|
||||
public async Task FindLastConfigChanges_ReturnsLastConfigChange()
|
||||
{
|
||||
@@ -66,6 +69,7 @@ internal class HistoricalConfigChangesServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the service returns <c>null</c> when the underlying repository throws an exception while inserting a <see cref="HistoricalConfigChanges"/> entity.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=095d7c4 body=2da7496 -->
|
||||
[Test]
|
||||
public async Task InsertOne_WhenExceptionOccurs_ReturnsNull()
|
||||
{
|
||||
@@ -84,6 +88,7 @@ internal class HistoricalConfigChangesServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the service's <c>GetAll</c> method returns all historical configuration changes retrieved from the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=31f3dbb body=26fefb6 -->
|
||||
[Test]
|
||||
public async Task GetAll_ReturnsAllConfigChanges()
|
||||
{
|
||||
@@ -105,6 +110,7 @@ internal class HistoricalConfigChangesServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the service's <c>GetByType</c> method returns the expected number of historical configuration changes for the specified configuration type.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=7b6a024 body=7e4b7fe -->
|
||||
[Test]
|
||||
public async Task GetByType_ReturnsCorrectAmountOfConfigs()
|
||||
{
|
||||
@@ -129,6 +135,7 @@ internal class HistoricalConfigChangesServiceTest
|
||||
/// Verifies that the service returns the expected number of historical configuration changes for a given user,
|
||||
/// confirming the repository result is correctly forwarded to the caller.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=bbf6fad body=0c5f8a6 -->
|
||||
[Test]
|
||||
public async Task GetByUser_ReturnsCorrectConfigs()
|
||||
{
|
||||
@@ -151,6 +158,7 @@ internal class HistoricalConfigChangesServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the service returns null when an exception is thrown while updating a historical configuration change, ensuring graceful error handling.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f467039 body=fce2a66 -->
|
||||
[Test]
|
||||
public async Task UpdateHistoricalConfigChange_WhenExceptionOccurs_ReturnsNull()
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@ public class InMemoryLockProviderTest
|
||||
/// <summary>
|
||||
/// Initializes a fresh <see cref="InMemoryLockProvider"/> instance for the test fixture, ensuring each test starts with a clean, isolated provider state.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d8eb19f body=68e18d0 -->
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
@@ -28,6 +29,7 @@ public class InMemoryLockProviderTest
|
||||
/// Retrieves the private <c>_locks</c> dictionary from the associated <see cref="InMemoryLockProvider"/> instance using reflection, exposing the underlying locks for inspection or manipulation in tests.
|
||||
/// </summary>
|
||||
/// <returns>The <see cref="ConcurrentDictionary{TKey, TValue}"/> mapping lock keys to their <see cref="SemaphoreSlim"/> instances held by the provider.</returns>
|
||||
/// <!-- aidoc:v1 sig=4b79234 body=b646f1a -->
|
||||
private ConcurrentDictionary<string, SemaphoreSlim> GetLocks()
|
||||
{
|
||||
var field = typeof(InMemoryLockProvider)
|
||||
@@ -39,6 +41,7 @@ public class InMemoryLockProviderTest
|
||||
/// <summary>
|
||||
/// Verifies that AcquireAsync returns <c>true</c> and creates a corresponding entry in the locks dictionary when called with a valid key and time span.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a1004f7 body=bd67473 -->
|
||||
[Test]
|
||||
public async Task AcquireAsync_ReturnsTrue_AndCreatesEntryInLocksDictionary()
|
||||
{
|
||||
@@ -55,6 +58,7 @@ public class InMemoryLockProviderTest
|
||||
/// <summary>
|
||||
/// Verifies that AcquireAsync returns false when the semaphore for the specified key is already occupied and the requested timeout expires before the lock can be acquired, and that the underlying semaphore is restored to a count of 1 after release.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=095560b body=d74126f -->
|
||||
[Test]
|
||||
public async Task AcquireAsync_ReturnsFalse_WhenSemaphoreOccupiedAndTimeoutExpires()
|
||||
{
|
||||
@@ -77,6 +81,7 @@ public class InMemoryLockProviderTest
|
||||
/// allowing a subsequent <c>AcquireAsync</c> for the same key to succeed and the semaphore's
|
||||
/// <c>CurrentCount</c> to transition back to its released value.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f6c51b5 body=9922475 -->
|
||||
[Test]
|
||||
public async Task ReleaseAsync_MakesSemaphoreAvailableForNextAcquire()
|
||||
{
|
||||
@@ -100,6 +105,7 @@ public class InMemoryLockProviderTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>ReleaseAsync</c> does not throw when invoked without a prior <c>AcquireAsync</c> for the given key, and remains safe to call multiple times after a single successful acquire.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=6c5ff9c body=919f96b -->
|
||||
[Test]
|
||||
public async Task ReleaseAsync_DoesNotThrow_WhenCalledWithoutPriorAcquire()
|
||||
{
|
||||
@@ -115,6 +121,7 @@ public class InMemoryLockProviderTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>AcquireAsync</c> is thread-safe for a given key, ensuring that only one caller can hold the semaphore at a time even when multiple tasks compete concurrently for the same key, and that a single semaphore instance is created and reused per key.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d53d431 body=e5e915a -->
|
||||
[Test]
|
||||
public async Task AcquireAsync_IsThreadSafe_OnlyOneHolderAtATime_SingleSemaphorePerKey()
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@ public class LightBeaconServiceTest
|
||||
/// and instantiating the <see cref="LightBeaconService"/> under test with those mocks.
|
||||
/// This setup runs before each test to ensure a clean, isolated test environment.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=18cf5be -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -66,6 +67,7 @@ public class LightBeaconServiceTest
|
||||
/// <summary>
|
||||
/// Integration test that verifies the light beacon service returns <see cref="LightBeaconColor.Off"/> for a given point of care when the patient has no associated beacon color.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=fa06230 body=9e0a869 -->
|
||||
[Ignore("Integration test")]
|
||||
[Test]
|
||||
public async Task GetBeaconColor()
|
||||
|
||||
@@ -25,6 +25,7 @@ public class MasterListServiceTest
|
||||
/// for use in unit tests. Configures the HTTP context with a test user principal, registers the master list repository
|
||||
/// in the service provider, and supplies default API settings.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=b470369 -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -95,6 +96,7 @@ public class MasterListServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>DeleteMasterListById</c> invokes the repository's <c>Delete</c> method once with the provided identifier when the master list is found.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ea99ebf body=df3195e -->
|
||||
[Test]
|
||||
public async Task DeleteMasterListById_ShouldCallRepositoryDelete_WhenMasterListFound()
|
||||
{
|
||||
@@ -132,6 +134,7 @@ public class MasterListServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the service returns the master list when it is found by the specified id.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ccec55b body=8cfdb62 -->
|
||||
[Test]
|
||||
public async Task GetMasterListById_ShouldReturnMasterList_WhenFound()
|
||||
{
|
||||
@@ -151,6 +154,7 @@ public class MasterListServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>GetMasterListByName</c> returns the matching <see cref="MasterList"/> when a master list with the specified name is found in the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=e75f465 body=49f48d4 -->
|
||||
[Test]
|
||||
public async Task GetMasterListByName_ShouldReturnMasterList_WhenFound()
|
||||
{
|
||||
@@ -170,6 +174,7 @@ public class MasterListServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the InsertMasterList service method returns the same <see cref="MasterList"/> instance that was inserted, ensuring the service correctly retrieves the inserted entity by its identifier after persistence.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d6a0851 body=1cc5b44 -->
|
||||
[Test]
|
||||
public async Task InsertMasterList_ShouldReturnInsertedMasterList()
|
||||
{
|
||||
@@ -191,6 +196,7 @@ public class MasterListServiceTest
|
||||
/// Verifies that UpdateMasterList returns the updated master list when the repository successfully completes the update and finds the entity by id.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="Task"/> representing the asynchronous test execution.</returns>
|
||||
/// <!-- aidoc:v1 sig=870cac2 body=e6d0735 -->
|
||||
[Test]
|
||||
public async Task UpdateMasterList_ShouldReturnUpdatedMasterList()
|
||||
{
|
||||
|
||||
@@ -68,6 +68,8 @@ public class MedicineServiceTest
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentNullException">Thrown when the local <see cref="List{PatientTreatment}"/> collection is null.</exception>
|
||||
/// <!-- aidoc:v1 sig=6587029 body=89ace4d -->
|
||||
/// <!-- aidoc-review:v1 severity=medium kind=extra_exception
|
||||
/// "ArgumentNullException is unreachable: patientTreatment is initialized to an empty list (List<PatientTreatment> patientTreatment = []) immediately before the null check, so the throw can never execute in practice." -->
|
||||
[Test]
|
||||
public async Task GetMedicinesOfTreatments_Null_Medicine_Return_0()
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@ public class NoCacheServiceTest
|
||||
/// Initializes a fresh <see cref="NoCacheService"/> instance and assigns it to <c>_noCacheService</c>
|
||||
/// to provide a clean, dependency-free test fixture prior to executing each test.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d8eb19f body=f419747 -->
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
@@ -87,6 +88,7 @@ public class NoCacheServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the no-cache service implementation never persists data to any backend when <c>GetOrSetObjectAsync</c> is invoked, and confirms that a subsequent <c>DeleteObjectAsync</c> on the same key does not throw.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=9b41a17 body=279c122 -->
|
||||
[Test]
|
||||
public async Task GetOrSetObjectAsync_DoesNotStoreData_InAnyBackend()
|
||||
{
|
||||
@@ -114,6 +116,7 @@ public class NoCacheServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the no-cache service's <c>DeleteByPatternAsync</c> returns 0 and does not throw when invoked with arbitrary patterns, confirming the no-op delete behavior for any key pattern.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d8ac365 body=97d47fa -->
|
||||
[Test]
|
||||
public async Task DeleteByPatternAsync_ReturnsZero_DoesNotThrow()
|
||||
{
|
||||
@@ -134,6 +137,7 @@ public class NoCacheServiceTest
|
||||
/// Verifies that calling CleanCache on the no-cache service is a safe no-op that does not throw,
|
||||
/// and that subsequent calls to GetValue consistently return <c>null</c> for any key.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=732eb50 body=c99cdf2 -->
|
||||
[Test]
|
||||
public void CleanCache_IsNoOp_DoesNotThrow()
|
||||
{
|
||||
@@ -149,6 +153,7 @@ public class NoCacheServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that calling <c>SetValue</c> on the no-cache service is a no-op and does not throw any exception.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=93ab163 body=4352e8e -->
|
||||
[Test]
|
||||
public void SetValue_IsNoOp_DoesNotThrow()
|
||||
{
|
||||
@@ -163,6 +168,7 @@ public class NoCacheServiceTest
|
||||
/// Verifies that the no-cache service's GetValue method returns null for any key,
|
||||
/// confirming that the no-op implementation does not return or simulate cached values.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=11d9010 body=0d07264 -->
|
||||
[Test]
|
||||
public void GetValue_IsNoOp_ReturnsNull()
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@ public class ObservationServiceTest
|
||||
/// and pre-configuring common lookup behavior for the default "UCI5C" unit (including <c>FindByName</c>
|
||||
/// and <c>FindById</c>) along with the <c>ICalculatedObservationsService.Map</c> passthrough.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=fc042ee -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -668,6 +669,7 @@ public class ObservationServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that when an isolation observation is processed through SaveRequest, the configuration observation and units mapping services are invoked, and the resulting mapped observation is inserted into the observation repository with the expected value, patient identifier, name, time, message time, and coding system.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=7f3122b body=1cb0aef -->
|
||||
[Test]
|
||||
public async Task ProcessIsolationObservation_Return_IsolationObs()
|
||||
{
|
||||
@@ -755,6 +757,7 @@ public class ObservationServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that processing a position observation through the observation service persists a new <see cref="PatientObservation"/> with the expected values (Value, PatientId, Name, Time, MessageTime, and CodingSystem) when a valid API request is provided.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=e65e6d9 body=fde3bdd -->
|
||||
[Test]
|
||||
public async Task ProcessPositionObservation_Return_PositionObs()
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@ internal class PatientServiceTest
|
||||
/// dependencies and pre-configuring common lookup scenarios for units and points of care, including virtual
|
||||
/// point of care states (Pushed, Moved, Deleted, Cancelled, Recovered, Unknown) used across test cases.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=ff2a3d0 -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -320,6 +321,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the patient service correctly retrieves a patient from the database by matching the patient number supplied in the API request, returning a patient populated with the expected unit, point of care, and patient number values.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ef29ee9 body=8931a6e -->
|
||||
[Test]
|
||||
public async Task Find_Patient_By_APIRequest_Get_Patient_By_PatientNumber()
|
||||
{
|
||||
@@ -371,6 +373,7 @@ internal class PatientServiceTest
|
||||
/// Verifies that <see cref="PatientService.FindPatientByApiRequest"/> creates a new patient record
|
||||
/// when the requested patient does not exist and the <c>CreatePatientWithOru</c> option is set to <c>true</c>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=06e0a26 body=2d5f690 -->
|
||||
[Test]
|
||||
public async Task Find_Patient_By_APIRequest_Not_Exists_CreatePatientWithORU_True_Created_Patient()
|
||||
{
|
||||
@@ -445,6 +448,7 @@ internal class PatientServiceTest
|
||||
/// while the target location is already occupied by another patient, and the <c>CreatePatientWithOru</c>
|
||||
/// option is enabled, the service creates a new patient in a temporal bed instead of reusing the occupied location.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a57196b body=beeb5bf -->
|
||||
[Test]
|
||||
public async Task
|
||||
Find_Patient_By_APIRequest_Not_Exists_And_Location_Ocuped_CreatePatientWithORU_True_Created_In_Temporal_Bed()
|
||||
@@ -530,6 +534,7 @@ internal class PatientServiceTest
|
||||
/// the <see cref="Patient"/> is not created in the temporal bed because <c>CreatePatientWithOru</c> is set to <c>false</c>.
|
||||
/// Ensures that <c>FindPatientByApiRequest</c> returns <c>null</c> and that the repository's <c>InsertOneAsync</c> is never invoked.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=e6921b4 body=35ecb59 -->
|
||||
[Test]
|
||||
public async Task Find_Patient_By_APIRequest_Not_Exists_CreatePatientWithORU_False_Not_Created_In_Temporal_Bed()
|
||||
{
|
||||
@@ -596,6 +601,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that when a patient is found by API request and the patient already exists in a different location in the database, the patient's location is not changed by the lookup operation.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d023325 body=4efbf14 -->
|
||||
[Test]
|
||||
public async Task Find_Patient_By_APIRequest_Exists_In_Different_Location_NOT_Changes_Patient_Location()
|
||||
{
|
||||
@@ -648,6 +654,7 @@ internal class PatientServiceTest
|
||||
/// Verifies that an ADT_A01 request correctly inserts a new patient into the specified unit and bed location
|
||||
/// by ensuring the patient repository is updated with the matching unit, bed, and patient number.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=54b6ee5 body=52efd9d -->
|
||||
[Test]
|
||||
public async Task ADT_A01_New_Patient_Empty_Bed_Insert_In_Location()
|
||||
{
|
||||
@@ -679,6 +686,7 @@ internal class PatientServiceTest
|
||||
/// Verifies that when an ADT_A01 request for a new patient is processed with an unknown location
|
||||
/// (i.e., the location mapping resolves to null), the patient is not inserted into the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a7816da body=592765f -->
|
||||
[Test]
|
||||
public async Task ADT_A01_New_Patient_Unknown_Location_Insert_Nothing()
|
||||
{
|
||||
@@ -708,6 +716,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that when an ADT_A01 admission request is received for a new patient targeting a bed that is already in use by an existing patient, the existing patient is moved to the temporal (pushed) bed while the new patient is admitted to the original bed.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f6f4884 body=f0a1e9f -->
|
||||
[Test]
|
||||
public async Task ADT_A01_New_Patient_Bed_In_Use_Moves_Existing_Patient_To_Temporal_Bed()
|
||||
{
|
||||
@@ -839,6 +848,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that when an ADT_A01 (Admit) message is received for a patient whose bed is already in use and whose patient number matches an existing patient, the patient's demographic data is updated while preserving the bed assignment and existing identifiers.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=207b25e body=bc34164 -->
|
||||
[Test]
|
||||
public async Task ADT_A01_New_Patient_Bed_In_Use_With_Same_Patient_Number_Updates_Demographic_Data()
|
||||
{
|
||||
@@ -910,6 +920,10 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that processing an ADT_A05 message for a new patient in a new bed (PatientLocation) results in the patient being updated with the correct unit, point of care, and patient number, and that the point-of-care mapping service is invoked to create the location.
|
||||
/// </summary>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The documentation says 'ADT_A05 message' but the code sets apiRequest.Type = 'ADT_A01', so the test processes an ADT_A01 message, not ADT_A05." -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The documentation claims the test verifies 'that the point-of-care mapping service is invoked to create the location', but there is no Verify call for _poCMappingServiceMock; only a Setup stub is configured, and only the patient repository's Update is verified." -->
|
||||
[Test]
|
||||
public async Task ADT_A05_New_Patient_New_Bed_Creates_Location()
|
||||
{
|
||||
@@ -944,6 +958,7 @@ internal class PatientServiceTest
|
||||
/// the existing patient in that bed is moved to a temporal PointOfCare, while the new patient
|
||||
/// is assigned to the original PointOfCare location.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=fbe1c2f body=f3b3776 -->
|
||||
[Test]
|
||||
public async Task ADT_A05_New_Patient_Bed_In_Use_Moves_Existing_Patient_To_Temporal_Bed()
|
||||
{
|
||||
@@ -1001,6 +1016,7 @@ internal class PatientServiceTest
|
||||
/// Verifies that when an ADT_A03 (End Visit) message is processed for a patient that does not exist,
|
||||
/// the patient repository's Update operation is never invoked, ensuring the system takes no action.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=569f0a9 body=4815209 -->
|
||||
[Test]
|
||||
public async Task ADT_A03_END_VISIT_PATIENT_NOT_EXISTS_DO_NOTHING()
|
||||
{
|
||||
@@ -1032,6 +1048,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that when an ADT_A03 (End Visit) request is processed for a patient that already exists in the database, the patient record is updated with the deleted Point of Care, the unit identifier is preserved, and the next admission check is triggered for the original Point of Care.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=df708cd body=1a6d3f8 -->
|
||||
[Test]
|
||||
public async Task ADT_A03_END_VISIT_PATIENT_EXISTS()
|
||||
{
|
||||
@@ -1177,6 +1194,7 @@ internal class PatientServiceTest
|
||||
/// service to resolve the destination location, ensuring the save operation results in a single
|
||||
/// insert for the new patient.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=6bb7428 body=852c38d -->
|
||||
[Test]
|
||||
public async Task ADT_A02_TRANSFER_PATIENT_FROM_NOT_EXISTS_BED_TO_BED_SHOULD_CREATE_PATIENT()
|
||||
{
|
||||
@@ -1223,6 +1241,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Tests the ADT_A02 transfer scenario where a patient is transferred from their current bed to a bed that is already occupied by another patient, verifying that the existing patient is moved to a new location, the transferring patient occupies the destination bed, and related discharge and next-admission checks are invoked.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=445abff body=64dbe17 -->
|
||||
[Test]
|
||||
public async Task ADT_A02_TRANSFER_PATIENT_FROM_BED_TO_IN_USE_BED()
|
||||
{
|
||||
@@ -1298,6 +1317,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that when an ADT_A02 transfer message is processed for a patient moving from a location with no existing patient to a bed that is already occupied, the previously assigned patient is moved to a temporal bed and the new patient is inserted into the vacated bed.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=4d1f5ba body=60f333b -->
|
||||
[Test]
|
||||
public async Task
|
||||
ADT_A02_TRANSFER_PATIENT_FROM_NOT_EXISTS_TO_NOT_EMPTY_BED_SHOULD_CHANGE_LAST_PATIENT_TO_TEMPORTAL_BED()
|
||||
@@ -1354,6 +1374,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that processing an ADT_A02 transfer request for a patient whose patient number already exists in the destination bed updates the existing patient's demographic data instead of creating a new patient record.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=33bdcd5 body=a2f7027 -->
|
||||
[Test]
|
||||
public async Task
|
||||
ADT_A02_TRANSFER_PATIENT_FROM_NOT_EXISTS_BED_TO_NOT_EMPTY_BED_WITH_SAME_PATIENT_NUMBER_SHOULD_UPTADE_DEMOGRAPHIC_DATA()
|
||||
@@ -1411,6 +1432,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that processing an ADT_A04 message for a new patient successfully creates and persists a patient record with the expected unit, point of care, and patient number.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=5feb5e2 body=5c4855e -->
|
||||
[Test]
|
||||
public async Task ADT_A04_New_Patient_Creates_Patient()
|
||||
{
|
||||
@@ -1443,6 +1465,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that when processing an ADT_A04 request for a new patient with a location whose POC mapping returns null, the patient is not persisted to the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ff36bdc body=a4fb145 -->
|
||||
[Test]
|
||||
public async Task ADT_A04_New_Patient_Not_Location_Creates_Patient()
|
||||
{
|
||||
@@ -1473,6 +1496,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that when an ADT_A08 request is received for a non-existent patient and the <c>CreatePatientWithAdtA08</c> option is enabled, the <see cref="PatientService"/> correctly creates the patient by calling the patient repository's <c>Update</c> method with the expected <c>UnitId</c>, <c>PointOfCareId</c>, and <c>PatientNumber</c> values.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=0011533 body=5222130 -->
|
||||
[Test]
|
||||
public async Task ADT_A08_No_exist_CreatePatientWithADT_A08_True_Patient_Creates_Patient()
|
||||
{
|
||||
@@ -1541,6 +1565,7 @@ internal class PatientServiceTest
|
||||
/// Verifies that when an ADT_A08 message is processed for a patient that does not exist and the
|
||||
/// <c>CreatePatientWithAdtA08</c> option is disabled, the patient is not inserted into the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=4787677 body=e1846b5 -->
|
||||
[Test]
|
||||
public async Task ADT_A08_No_exist_Patient_Not_Creates_Patient()
|
||||
{
|
||||
@@ -1608,6 +1633,7 @@ internal class PatientServiceTest
|
||||
/// and patient creation on ADT_A08 is disabled, the patient is updated rather than created.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous test execution.</returns>
|
||||
/// <!-- aidoc:v1 sig=f8df471 body=e1407e8 -->
|
||||
[Test]
|
||||
public async Task ADT_A08_Exist_Patient_Update_Patient()
|
||||
{
|
||||
@@ -1681,6 +1707,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that processing an ADT_A11 (cancel admit/visit notification) message for an existing patient updates the patient's location to the cancelled point of care, leaving unit, patient number, and identity fields unchanged.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d05b038 body=5bf7535 -->
|
||||
[Test]
|
||||
public async Task ADT_A11_Exist_Patient_CANCELLED_Patient()
|
||||
{
|
||||
@@ -1757,6 +1784,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that when an ADT_A11 (cancel admit/visit notification) request is processed for a non-existent patient, the patient repository's <c>UpdateOneAsync</c> method is never invoked, since there is no existing patient record to update.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=cc97dcc body=7db5096 -->
|
||||
[Test]
|
||||
public async Task ADT_A11_No_Exist_Patient_Not_CANCELLED_Patient()
|
||||
{
|
||||
@@ -1819,6 +1847,7 @@ internal class PatientServiceTest
|
||||
/// Verifies that processing an ADT_A12 transfer message for a non-existing patient to an empty bed
|
||||
/// results in the patient being created and assigned to the target bed via the point-of-care mapping.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=eb39efa body=6eec376 -->
|
||||
[Test]
|
||||
public async Task ADT_A12_TRANSFER_PATIENT_NOT_EXISTS_TO_EMPTY_BED_SHOULD_CREATE_BED()
|
||||
{
|
||||
@@ -1852,6 +1881,7 @@ internal class PatientServiceTest
|
||||
/// creates the bed (represented by a new point of care) and persists the patient's transfer to that
|
||||
/// new location under the configured unit.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=7d75980 body=1a080c9 -->
|
||||
[Test]
|
||||
public async Task ADT_A12_TRANSFER_PATIENT_FROM_BED_TO_NOT_EXISTS_BED_SHOULD_CREATE_BED()
|
||||
{
|
||||
@@ -1893,6 +1923,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that when an ADT_A12 transfer request is processed, the new patient occupying the target bed has their data updated while the displaced patient is relocated to a different point of care, and that the legacy <c>Update</c> method is not invoked.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=788fe08 body=89347c8 -->
|
||||
[Test]
|
||||
public async Task ADT_A12_TRANSFER_PATIENT_FROM_BED_TO_IN_USE_BED()
|
||||
{
|
||||
@@ -1967,6 +1998,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that when an ADT_A12 transfer is processed for a patient moving to a bed that is already occupied, the existing patient in that bed is moved to a temporary bed (different Point of Care), and the transferred patient is inserted into the target bed.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b3f2ed3 body=a43a5e5 -->
|
||||
[Test]
|
||||
public async Task
|
||||
ADT_A12_TRANSFER_PATIENT_NOT_EXISTS_TO_NOT_EMPTY_BED_SHOULD_CHANGE_LAST_PATIENT_TO_TEMPORTAL_BED()
|
||||
@@ -2021,6 +2053,8 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that when an ADT_A13 transfer request is processed for a patient moving to a bed that is already occupied, the previously assigned patient in that bed is moved to a temporal bed while the transferring patient is persisted in the requested location.
|
||||
/// </summary>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "Summary claims the previously assigned patient is moved to a temporal bed, but the test only verifies that the transferring patient is updated at the target location; no assertion or mock verifies the prior occupant's relocation to a temporal bed." -->
|
||||
[Test]
|
||||
public async Task
|
||||
ADT_A13_TRANSFER_PATIENT_NOT_EXISTS_TO_NOT_EMPTY_BED_SHOULD_CHANGE_LAST_PATIENT_TO_TEMPORTAL_BED()
|
||||
@@ -2063,6 +2097,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that processing an ADT_A13 transfer request for a patient assigned to a deleted point of care moves the patient to the recovered (temporal) bed location.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d80f16e body=ea343c5 -->
|
||||
[Test]
|
||||
public async Task ADT_A13_TRANSFER_PATIENT_NOT_EXISTS_TO_EMPTY_BED_SHOULD_CHANGE_LAST_PATIENT_TO_TEMPORTAL_BED()
|
||||
{
|
||||
@@ -2112,6 +2147,7 @@ internal class PatientServiceTest
|
||||
/// Verifies that processing an ADT_A31 (Update Patient) HL7 request correctly updates the existing patient's demographic
|
||||
/// information (last name and birth date) while preserving the assigned unit and point of care identifiers.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d30f8e5 body=1a5e43f -->
|
||||
[Test]
|
||||
public async Task ADT_A31_Upadate_Patient()
|
||||
{
|
||||
@@ -2159,6 +2195,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that when an ADT_A31 update request is processed for a patient that does not exist, the patient is not updated. Ensures the repository's Update method is never invoked in the not-found scenario.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=c01058d body=e9b1919 -->
|
||||
[Test]
|
||||
public async Task ADT_A31_Upadate_Patient_Not_Found_Not_Update()
|
||||
{
|
||||
@@ -2191,6 +2228,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that when an ADT_A39 merge patient request is processed, the old patient record is deleted after the new patient is resolved through the point-of-care mapping and patient repository lookups.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b442eb3 body=32ea4bf -->
|
||||
[Test]
|
||||
public async Task ADT_A39_Merge_Patient()
|
||||
{
|
||||
@@ -2246,6 +2284,7 @@ internal class PatientServiceTest
|
||||
/// Verifies that when an <c>ADT_A39</c> request is processed and the patient is not an old patient (i.e., not a merge case),
|
||||
/// the <see cref="PatientService.SaveRequest"/> does not delete the existing patient from the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=0442333 body=8b45017 -->
|
||||
[Test]
|
||||
public async Task ADT_A39_Not_OldPatient_Not_Merge_Patient()
|
||||
{
|
||||
@@ -2285,6 +2324,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that processing an ADT_A39 (merge patient) request does not result in the deletion of the old patient record, even when the old patient is located by number.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=85734e7 body=fdeab08 -->
|
||||
[Test]
|
||||
public async Task ADT_A39_Not_Patient_Not_Merge_Patient()
|
||||
{
|
||||
@@ -2328,6 +2368,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the patient service correctly handles an ADT_A44 patient merge/update request by locating the existing patient via the old patient number and updating it in the repository with the new patient information.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=cd35acc body=16982fd -->
|
||||
[Test]
|
||||
public async Task ADT_A44_Upadate_Patient()
|
||||
{
|
||||
@@ -2369,6 +2410,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that processing an ADT_A44 request for a patient that is not an old patient does not trigger a patient update.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=84f3f56 body=0fdeb6d -->
|
||||
[Test]
|
||||
public async Task ADT_A44_Not_OldPatient_Not__Upadate_Patient()
|
||||
{
|
||||
@@ -2402,6 +2444,7 @@ internal class PatientServiceTest
|
||||
/// through the patient service by calling <c>SaveRequest</c> with an <c>ApiRequest</c> of type "ICCA" containing four
|
||||
/// patients located in different points of care, and confirms each one is persisted exactly once via the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=db9be10 body=6c05a4c -->
|
||||
[Test]
|
||||
public async Task ICCA_Process_No_Patient_BD_Insert_ICCA_Patients()
|
||||
{
|
||||
@@ -2470,6 +2513,7 @@ internal class PatientServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that when an ICCA patient request is processed and a patient already exists in the database at the same point of care but with a different patient number, the existing patient is updated to the moved point of care and the new ICCA patient is inserted.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=844f9ba body=c4fd746 -->
|
||||
[Test]
|
||||
public async Task ICCA_Process_Patient_BD_Insert_ICCA_Patient_Pushed_Actual_Patient()
|
||||
{
|
||||
@@ -2527,6 +2571,7 @@ internal class PatientServiceTest
|
||||
/// and the ICCA patients collection is empty, the existing patient is updated with the UNKNOWN
|
||||
/// PointOfCareId and no new patient is inserted into the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a53cb38 body=a8ccf49 -->
|
||||
[Test]
|
||||
public async Task ICCA_Process_Patient_BD_No_Insert_ICCA_Patient_UNKNOWN_Actual_Patient()
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@ public class PointOfCareServiceTests
|
||||
/// Configures repository, service, cache, admission, unit, and HTTP context mocks, including a simulated authenticated user
|
||||
/// and cache behavior that invokes the supplied factory directly to return the produced <see cref="PointOfCare"/> instance.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d8eb19f body=249b5e3 -->
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
@@ -84,6 +85,7 @@ public class PointOfCareServiceTests
|
||||
/// when invoked with a valid <see cref="ObjectId"/> whose associated admission is <c>null</c>, ensuring
|
||||
/// the underlying repository's delete operation is invoked.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=fbe967c body=3dbace5 -->
|
||||
[Test]
|
||||
public async Task Delete_ValidObjectId_DeletesPointOfCare()
|
||||
{
|
||||
@@ -105,6 +107,7 @@ public class PointOfCareServiceTests
|
||||
/// <see cref="PointOfCare"/> instance by delegating the operation to the underlying repository.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="Task"/> representing the asynchronous test execution.</returns>
|
||||
/// <!-- aidoc:v1 sig=ce1f679 body=430d93e -->
|
||||
[Test]
|
||||
public async Task Update_ValidPointOfCare_UpdatesPointOfCare()
|
||||
{
|
||||
@@ -122,6 +125,7 @@ public class PointOfCareServiceTests
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="PointOfCareService.GetAll"/> returns the complete list of point of care records provided by the repository when invoked with no arguments.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1ff5b52 body=e781807 -->
|
||||
[Test]
|
||||
public async Task GetAll_NoArguments_ReturnsListOfPointOfCare()
|
||||
{
|
||||
@@ -139,6 +143,7 @@ public class PointOfCareServiceTests
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="PointOfCareService.UpdateConfiguration"/> throws a <see cref="ConflictException"/> when invoked with a valid id and configuration, ensuring the service surfaces conflict conditions during the update operation.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1b073df body=7d7853b -->
|
||||
[Test]
|
||||
public void UpdateConfiguration_ValidIdAndConfiguration_InvokesRepositoryUpdateConfiguration()
|
||||
{
|
||||
@@ -157,6 +162,7 @@ public class PointOfCareServiceTests
|
||||
/// <summary>
|
||||
/// Verifies that <c>FindById</c> returns the expected <see cref="PointOfCare"/> when a valid identifier is provided.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=8808d2e body=a1b38fe -->
|
||||
[Test]
|
||||
public async Task FindById_ValidId_ReturnsPointOfCare()
|
||||
{
|
||||
@@ -196,6 +202,7 @@ public class PointOfCareServiceTests
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="PointOfCareService.FindByUnitAndStatus"/> returns the expected list of point-of-care records when invoked with a valid unit identifier and status.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dda43eb body=2469c00 -->
|
||||
[Test]
|
||||
public async Task FindByUnitAndStatus_ValidUnitIdAndStatus_ReturnsListOfPointOfCare()
|
||||
{
|
||||
@@ -300,6 +307,7 @@ public class PointOfCareServiceTests
|
||||
/// <summary>
|
||||
/// Tests that the service's FindByRoom method, when called with a valid room, returns the collection provided by the repository and invokes the repository's FindByRoom exactly once.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=89ccc77 body=dd6415f -->
|
||||
[Test]
|
||||
public async Task FindByRoom_ValidRoom_CallsRepositoryFindByRoom()
|
||||
{
|
||||
@@ -319,6 +327,7 @@ public class PointOfCareServiceTests
|
||||
/// <summary>
|
||||
/// Verifies that the <see cref="PointOfCareService.FindByBed"/> method correctly delegates to the repository's FindByBed method when a valid bed identifier is provided, returning the expected collection of point of care records.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=28d655e body=0851f2e -->
|
||||
[Test]
|
||||
public async Task FindByBed_ValidBed_CallsRepositoryFindByBed()
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@ public class PublisherServiceTest
|
||||
/// <summary>
|
||||
/// Initializes the test environment for <see cref="PublisherService"/> by configuring RabbitMQ settings, creating a mocked logger, and instantiating the service under test.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=b5bc3e1 -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -50,6 +51,7 @@ public class PublisherServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the publisher service's SendMessage method returns a non-null result when sending a message to the observations queue.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ec11b0e body=15bae5a -->
|
||||
[Test]
|
||||
public void SendMessage_Return_true()
|
||||
{
|
||||
@@ -63,6 +65,7 @@ public class PublisherServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>SendMessageError</c> returns a non-null result when publishing a new <see cref="Message{Error}"/> to the observations queue.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=565955d body=04f3cbb -->
|
||||
[Test]
|
||||
public void SendMessage_Error_Return_true()
|
||||
{
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@ public class RecordingAlertServiceTest
|
||||
/// <summary>
|
||||
/// Initializes the mocked dependencies and test infrastructure required by the <see cref="RecordingAlertService"/> unit tests, including service and repository mocks, a fake HTTP context with a "TestUser" claim, and the system-under-test instance.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=ef6880f -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -88,6 +89,7 @@ public class RecordingAlertServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="RecordingAlertService.SaveRequest"/> does not persist a <see cref="PatientRecordingAlert"/> when the provided <see cref="ApiRequest"/> is neither a recording alert nor an ORU R01 message.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=25109a2 body=153205d -->
|
||||
[Test]
|
||||
public async Task SaveRequest_Not_RecordingAlert_Not_ORU_R01_Return_not_insert()
|
||||
{
|
||||
@@ -101,6 +103,7 @@ public class RecordingAlertServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="RecordingAlertService.SaveRequest"/> does not insert a <see cref="PatientRecordingAlert"/> when both the patient number and point of care are null in the <see cref="ApiRequest"/>, even when the message type is "ORU_R11".
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=84b4d02 body=8ae3d26 -->
|
||||
[Test]
|
||||
public async Task SaveRequest_patientNumber_and_pointOfCare_null_Return_not_insert()
|
||||
{
|
||||
@@ -118,6 +121,7 @@ public class RecordingAlertServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the SaveRequest method does not insert a patient recording alert when the specified patient cannot be found.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=67b2be6 body=931ed14 -->
|
||||
[Test]
|
||||
public async Task SaveRequest_Not_Find_Patient_Return_not_insert()
|
||||
{
|
||||
@@ -146,6 +150,7 @@ public class RecordingAlertServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that SaveRequest inserts a new <see cref="PatientRecordingAlert"/> into the repository when the configuration observation service returns no retention actions for the given recording alert.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=9d79768 body=ecbd046 -->
|
||||
[Test]
|
||||
public async Task SaveRequest_Alert_Return_insert()
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@ public class RecordingServiceTest
|
||||
/// dependencies (logger, HTTP client factory, publisher, authentication, client message, subscribers, and patient services),
|
||||
/// and configuring the publisher mock to successfully send both regular messages and errors.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=858be2c -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -108,6 +109,7 @@ public class RecordingServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="RecordingService.GetRecordings"/> returns an empty collection of <see cref="RecordingData"/> when the HTTP response indicates an unauthorized (401) status, ensuring the service correctly handles failed authentication scenarios by yielding no recordings rather than throwing or returning null.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2d4a973 body=2d5face -->
|
||||
[Test]
|
||||
public async Task GetRecordings_Return_Empty()
|
||||
{
|
||||
@@ -138,6 +140,7 @@ public class RecordingServiceTest
|
||||
/// when the HTTP endpoint responds with a successful payload containing a recording and its associated patient.
|
||||
/// Asserts that the returned items match the source data for status, room identifier, and patient identity fields.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a268bca body=27cf99d -->
|
||||
[Test]
|
||||
public async Task GetRecordings_Return_RecordingData()
|
||||
{
|
||||
@@ -187,6 +190,7 @@ public class RecordingServiceTest
|
||||
/// <summary>
|
||||
/// Tests that calling <c>SaveRequest</c> on the recording service throws a <see cref="NotImplementedException"/> when supplied with an <see cref="ApiRequest"/>, using a mocked HTTP message handler that returns a successful response.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=e3a0b21 body=247c17b -->
|
||||
[Test]
|
||||
public Task SaveRequest()
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@ public class RedisLockProviderTest
|
||||
/// <summary>
|
||||
/// Initializes the test environment by creating a mock <see cref="IDatabase"/> and instantiating a <see cref="RedisLockProvider"/> configured to use the mocked database.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d8eb19f body=aaffb29 -->
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
@@ -32,6 +33,7 @@ public class RedisLockProviderTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>AcquireAsync</c> returns <c>true</c>, stores the lock token under the <c>lock:</c> prefixed key, applies the configured TTL, and uses the <c>When.NotExists</c> flag when Redis accepts the NX SET operation. Also asserts that a subsequent <c>ReleaseAsync</c> invokes the Redis release script.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=70f9b70 body=cb5fcc3 -->
|
||||
[Test]
|
||||
public async Task AcquireAsync_ReturnsTrue_AndStoresToken_WhenRedisAcceptsNxSet()
|
||||
{
|
||||
@@ -78,6 +80,7 @@ public class RedisLockProviderTest
|
||||
/// Asserts the call is retried the expected number of times and that the elapsed time confirms
|
||||
/// delays were actually applied between attempts.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d11d703 body=9ec3583 -->
|
||||
[Test]
|
||||
public async Task AcquireAsync_RetriesWithDelays_UntilNxSucceeds()
|
||||
{
|
||||
@@ -112,6 +115,7 @@ public class RedisLockProviderTest
|
||||
/// <summary>
|
||||
/// Verifies that AcquireAsync returns <c>false</c> and performs multiple retry attempts when the underlying lock acquisition operation consistently fails within the specified timeout.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b5c5d4f body=131b234 -->
|
||||
[Test]
|
||||
public async Task AcquireAsync_ReturnsFalse_AfterTimeoutWithMultipleRetries()
|
||||
{
|
||||
@@ -142,6 +146,7 @@ public class RedisLockProviderTest
|
||||
/// <summary>
|
||||
/// Verifies that releasing a lock invokes the Lua script evaluation with the correct lock key (prefixed with "lock:") and the token previously captured during lock acquisition.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a27fd67 body=af51113 -->
|
||||
[Test]
|
||||
public async Task ReleaseAsync_CallsScriptEvaluateWithCorrectKeyAndToken()
|
||||
{
|
||||
@@ -181,6 +186,7 @@ public class RedisLockProviderTest
|
||||
/// Verifies that ReleaseAsync is idempotent when invoked without a prior acquire operation,
|
||||
/// ensuring that no script evaluation is performed on the underlying database in this scenario.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=34ada35 body=27f9924 -->
|
||||
[Test]
|
||||
public async Task ReleaseAsync_IsIdempotent_WhenCalledWithoutPriorAcquire()
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@ public class RedisServiceTest
|
||||
/// <summary>
|
||||
/// Initializes test dependencies before each test execution by creating a mock <see cref="IDatabase"/> instance and instantiating the <see cref="LockManagerService"/> with a mocked logger and an in-memory lock provider.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d8eb19f body=f7d3912 -->
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
@@ -40,6 +41,7 @@ public class RedisServiceTest
|
||||
/// <param name="settings">Optional cache settings to apply; when <c>null</c>, a new default <see cref="CacheSettings"/> instance is used.</param>
|
||||
/// <param name="redisAvailable">Flag indicating whether the Redis service should be marked as available; defaults to <c>true</c>.</param>
|
||||
/// <returns>A <see cref="RedisService"/> instance with the database and availability state initialized for testing.</returns>
|
||||
/// <!-- aidoc:v1 sig=3b2c312 body=dfaacef -->
|
||||
private RedisService CreateSut(CacheSettings? settings = null, bool redisAvailable = true)
|
||||
{
|
||||
var sut = new RedisService(
|
||||
@@ -59,6 +61,7 @@ public class RedisServiceTest
|
||||
/// <param name="target">The <see cref="RedisService"/> instance whose field will be set.</param>
|
||||
/// <param name="name">The name of the non-public instance field to assign.</param>
|
||||
/// <param name="value">The value to assign to the field. Can be null.</param>
|
||||
/// <!-- aidoc:v1 sig=29fabd1 -->
|
||||
private static void SetField(object target, string name, object? value)
|
||||
=> typeof(RedisService)
|
||||
.GetField(name, BindingFlags.NonPublic | BindingFlags.Instance)!
|
||||
@@ -67,6 +70,7 @@ public class RedisServiceTest
|
||||
/// <summary>
|
||||
/// Configures the mock database to return a successful result (<c>true</c>) for any invocation of <c>StringSetAsync</c>, regardless of the supplied key, value, expiry, overwrite flag, condition, or command flags.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=98682b4 -->
|
||||
private void SetupStringSetAsync()
|
||||
=> _mockDb
|
||||
.Setup(db => db.StringSetAsync(
|
||||
@@ -77,6 +81,7 @@ public class RedisServiceTest
|
||||
/// <summary>
|
||||
/// Configures the mock Redis database to handle <c>KeyExpire</c> calls by returning <c>true</c> for any combination of key, expiration, condition, and command flag arguments.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=0ffd573 -->
|
||||
private void SetupKeyExpire()
|
||||
=> _mockDb
|
||||
.Setup(db => db.KeyExpire(
|
||||
@@ -88,6 +93,7 @@ public class RedisServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>GetOrSetObjectAsync</c> invokes the supplied factory when Redis is unavailable, returning the factory's result without attempting any Redis read or write operations.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=1a73907 body=b6ad74e -->
|
||||
[Test]
|
||||
public async Task GetOrSetObjectAsync_ExecutesFactory_WhenRedisUnavailable()
|
||||
{
|
||||
@@ -111,6 +117,7 @@ public class RedisServiceTest
|
||||
/// when a value is present in the cache, without invoking the factory delegate and without
|
||||
/// attempting to write back to Redis.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=ff045fa body=9481052 -->
|
||||
[Test]
|
||||
public async Task GetOrSetObjectAsync_ReturnsCachedObject_WhenRedisHit()
|
||||
{
|
||||
@@ -138,6 +145,7 @@ public class RedisServiceTest
|
||||
/// Verifies that <c>GetObjectAsync</c> calls the underlying Redis <c>KeyExpire</c> command with the configured TTL
|
||||
/// when the <c>updateExpiration</c> flag is set to <c>true</c>, ensuring cache entries are refreshed upon a successful hit.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=066b548 body=8421fd4 -->
|
||||
[Test]
|
||||
public async Task GetObjectAsync_CallsKeyExpire_WhenUpdateExpirationIsTrue()
|
||||
{
|
||||
@@ -167,6 +175,7 @@ public class RedisServiceTest
|
||||
/// Verifies that <c>GetObjectAsync</c> does not invoke the Redis key expiration command
|
||||
/// when the caller explicitly requests that the existing expiration be left unchanged.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=e10e6a3 body=d0256b9 -->
|
||||
[Test]
|
||||
public async Task GetObjectAsync_DoesNotCallKeyExpire_WhenUpdateExpirationIsFalse()
|
||||
{
|
||||
@@ -190,6 +199,7 @@ public class RedisServiceTest
|
||||
/// Ensures the factory delegate is executed, the deserialized value matches the factory output, and the
|
||||
/// object is written to cache with the expected expiration.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=775bb73 body=a143def -->
|
||||
[Test]
|
||||
public async Task GetOrSetObjectAsync_InvokesFactoryAndPersists_WhenCacheMiss()
|
||||
{
|
||||
@@ -232,6 +242,7 @@ public class RedisServiceTest
|
||||
/// Verifies that when the cache lookup returns no value and the factory delegate produces <c>null</c>,
|
||||
/// the method returns <c>null</c> and does not persist any value to the underlying cache store.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=67a4b2b body=95662d2 -->
|
||||
[Test]
|
||||
public async Task GetOrSetObjectAsync_DoesNotPersist_WhenFactoryReturnsNull()
|
||||
{
|
||||
@@ -256,6 +267,7 @@ public class RedisServiceTest
|
||||
/// Verifies that <c>GetObjectAsync</c> successfully retrieves and deserializes the stored object while skipping the
|
||||
/// key-expiration refresh when <c>updateExpiration</c> is set to <c>false</c>, ensuring <c>KeyExpire</c> is never invoked.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f1dc303 body=114b61f -->
|
||||
[Test]
|
||||
public async Task GetObjectAsync_ReturnsObject_AndSkipsKeyExpire_WhenUpdateExpirationFalse()
|
||||
{
|
||||
@@ -280,6 +292,7 @@ public class RedisServiceTest
|
||||
/// Verifies that <c>SetObjectAsync</c> serializes the supplied object to JSON and persists it in Redis
|
||||
/// with the entity-specific TTL (600 seconds) configured for the "Patients" entity in <see cref="CacheSettings"/>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=053126b body=05a7fbb -->
|
||||
[Test]
|
||||
public async Task SetObjectAsync_SerializesToJson_AndPersistsWithEntityTtl()
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ public class RelayServiceTest
|
||||
/// <summary>
|
||||
/// Sets up the test environment by initializing mocks and dependencies required for unit testing the <see cref="RelayService"/>, including logger, HTTP client factory, HTTP message handler, relay settings, point-of-care service, and relay repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=f8dc12e -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -62,6 +63,8 @@ public class RelayServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the relay service successfully powers off a relay by issuing an HTTP request through the configured HTTP client factory.
|
||||
/// </summary>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The summary claims the test 'verifies that the relay service successfully powers off a relay', but the test contains no assertions—it only sets up mocks and calls PowerOff without verifying any outcome." -->
|
||||
[Test]
|
||||
public async Task PowerOffAsync()
|
||||
{
|
||||
@@ -100,6 +103,7 @@ public class RelayServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="RelayService.PowerOn"/> correctly sends a power-on request to the configured relay device using the HTTP client.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=44fe1e4 body=914160c -->
|
||||
[Test]
|
||||
public async Task PowerOnAsync()
|
||||
{
|
||||
@@ -138,6 +142,7 @@ public class RelayServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>CheckRelayStatus</c> returns <see cref="RelayEnum.Status.On"/> when the mocked HTTP response indicates the relay is on.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2a547df body=bf57c2c -->
|
||||
[Test]
|
||||
public async Task CheckRelayStatus_Return_On()
|
||||
{
|
||||
@@ -226,6 +231,7 @@ public class RelayServiceTest
|
||||
/// driver response does not match a recognized on/off state (e.g., the raw payload "\\Off" is not
|
||||
/// mapped to a known status).
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=85fcbc2 body=fd57b78 -->
|
||||
[Test]
|
||||
public async Task CheckRelayStatus_Return_Unknown()
|
||||
{
|
||||
|
||||
@@ -348,6 +348,7 @@ public class SchedulerServiceTest
|
||||
/// Verifies that the <see cref="CheckInactivePatientsJob"/> is executed when its Quartz.NET trigger fires,
|
||||
/// ensuring the scheduled job invokes the patient discharge process for inactive patients at the configured interval.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=433f153 body=564acd0 -->
|
||||
[Test]
|
||||
public void CheckInactivePatientsJob_ShouldExecuteOnTrigger()
|
||||
{
|
||||
@@ -387,6 +388,7 @@ public class SchedulerServiceTest
|
||||
/// when triggered, and that the medicine service is invoked exactly once to retrieve medicines
|
||||
/// for the active treatments of the mocked patients.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=01d636e body=f71f2df -->
|
||||
[Test]
|
||||
public void CheckActiveTreatmentsJob_ShouldExecuteOnTrigger()
|
||||
{
|
||||
@@ -460,6 +462,7 @@ public class SchedulerServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the <see cref="CheckExpiredObservationsJob"/> is executed at least once by the Quartz.NET scheduler when triggered with a recurring schedule.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=77a1a73 body=9a546f0 -->
|
||||
[Test]
|
||||
public void CheckExpiredObservationsJob_ShouldExecuteOnTrigger()
|
||||
{
|
||||
@@ -493,6 +496,7 @@ public class SchedulerServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the <see cref="CheckExpiredAlertsJob"/> is executed when triggered by the Quartz.NET scheduler, ensuring that the <c>ExpireAlertsAndPowerOffAsync</c> method on the observation service is invoked at least once.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=0e98299 body=a3d213c -->
|
||||
[Test]
|
||||
public void CheckExpiredAlertsJob_ShouldExecuteOnTrigger()
|
||||
{
|
||||
@@ -527,6 +531,7 @@ public class SchedulerServiceTest
|
||||
/// <c>InsertObservation</c> with a <see cref="PatientObservation"/> whose <c>Name</c> is not "NEWS", ensuring
|
||||
/// that only NEWS observations are considered for persistence during scheduled execution.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=efdce93 body=5423389 -->
|
||||
[Test]
|
||||
public void GetProvidersObservationsJob_ShouldExecuteOnTrigger_Result_GetType_null()
|
||||
{
|
||||
@@ -577,6 +582,7 @@ public class SchedulerServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the <see cref="CalculateNewsJob"/> is executed when triggered by the Quartz.NET scheduler, confirming that the associated <c>InsertObservation</c> call on the observation service is invoked at least once within the allowed execution window.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2db113b body=674d8bd -->
|
||||
[Test]
|
||||
public void CheckCalculateNewsJob_ShouldExecuteOnTrigger()
|
||||
{
|
||||
@@ -610,6 +616,7 @@ public class SchedulerServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="CalculateNewsJob.Execute"/> correctly inserts NEWS observations with the expected calculated values (1 and 4) for multiple patients in a single execution.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a18d2b9 body=bc2ddd0 -->
|
||||
[Test]
|
||||
public async Task CalculateNewsJob_Insert_ObsFull_MultiplePatient_With_Correct_Value()
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@ public class SendAlertServiceTest
|
||||
/// RabbitMQ options, a mocked logger, an instance of the service under test, and the set
|
||||
/// of Windows platform identifiers used to validate platform-specific behavior.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=764cb7d -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -54,6 +55,7 @@ public class SendAlertServiceTest
|
||||
/// reading (non-null with a positive <c>ValueTotal</c>) when executed on a Windows platform. When the
|
||||
/// host operating system is not Windows, the test is skipped with an ignore notice.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=679f280 body=1dd0797 -->
|
||||
[Ignore("Integration test to pull request")]
|
||||
[Test]
|
||||
public void GetConsumedCpu_Return_PerformanceCpu_data()
|
||||
@@ -78,6 +80,7 @@ public class SendAlertServiceTest
|
||||
/// for <c>PercentageConsumed</c>, <c>ValueConsumed</c>, and <c>ValueTotal</c>. The test only executes on
|
||||
/// Windows platforms and is ignored on other operating systems.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=7a39a99 body=abcb5c0 -->
|
||||
[Ignore("Integration test to pull request")]
|
||||
[Test]
|
||||
public void GetConsumedRAM_Return_PerformanceRAM_data()
|
||||
@@ -104,6 +107,7 @@ public class SendAlertServiceTest
|
||||
/// <summary>
|
||||
/// Integration test that verifies the GetConsumedStorage method returns valid Performance data with positive percentage and value metrics for all ready drives on Windows platforms. The test is ignored when executed on a non-Windows platform.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a2098e9 body=3485f79 -->
|
||||
[Ignore("Integration test to pull request")]
|
||||
[Test]
|
||||
public void GetConsumedStorage_Return_PerformanceStorage_data()
|
||||
|
||||
@@ -17,6 +17,7 @@ public class ServiceConfigServiceTest
|
||||
/// <summary>
|
||||
/// Initializes the test environment by creating mock instances of the service configuration repository and logger, and instantiating the <see cref="ServiceConfigService"/> under test.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=beef729 -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -41,6 +42,7 @@ public class ServiceConfigServiceTest
|
||||
/// Verifies that the <see cref="ServiceConfig"/> service returns a <see cref="ServiceConfig"/> instance
|
||||
/// when retrieving an existing configuration by its string identifier.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=9b53d80 body=c9ed65c -->
|
||||
[Test]
|
||||
public async Task Get_Find_Id_Return_ServiceConfig()
|
||||
{
|
||||
@@ -59,6 +61,7 @@ public class ServiceConfigServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the Get method returns a <see cref="ServiceConfig"/> when the specified id is not found by the repository's <c>FindById</c>, falling back to a lookup with any <see cref="ObjectId"/>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=575d813 body=2042ef1 -->
|
||||
[Test]
|
||||
public async Task Get_Not_Find_Id_Return_ServiceConfig()
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ public class TreatmentServiceTest
|
||||
/// <summary>
|
||||
/// Initializes the mock dependencies and creates a <see cref="TreatmentService"/> instance for unit testing.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=dee8bf2 body=e1a20f3 -->
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -183,6 +184,7 @@ public class TreatmentServiceTest
|
||||
/// Verifies that saving an <see cref="ApiRequest"/> without the Case option throws an <see cref="ApiRequestException"/>, preventing the insert operation.
|
||||
/// </summary>
|
||||
/// <exception cref="ApiRequestException">Thrown by the service when the Case option is not provided in the request.</exception>
|
||||
/// <!-- aidoc:v1 sig=e189a56 body=217df39 -->
|
||||
[Test]
|
||||
public void SaveRequest_Not_Case_option_Return_not_insert()
|
||||
{
|
||||
@@ -195,6 +197,7 @@ public class TreatmentServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that _treatmentService.SaveRequest throws an <see cref="ApiRequestException"/> when the <see cref="ApiRequest"/> is missing both the patient number and the point of care, preventing insertion of an incomplete request.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=641365f body=4992b53 -->
|
||||
[Test]
|
||||
public void SaveRequest_patientNumber_and_pointOfCare_null_Return_not_insert()
|
||||
{
|
||||
@@ -211,6 +214,7 @@ public class TreatmentServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that _treatmentService.SaveRequest does not insert a patient treatment record when the patient cannot be found in the archive.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=67b2be6 body=c16d218 -->
|
||||
[Test]
|
||||
public async Task SaveRequest_Not_Find_Patient_Return_not_insert()
|
||||
{
|
||||
@@ -239,6 +243,7 @@ public class TreatmentServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that SaveRequest does not insert a new patient treatment into the treatment archive when an existing patient is found by patient number.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=2b730f8 body=b50d935 -->
|
||||
[Test]
|
||||
public async Task SaveRequest_Find_Patient_Return_insert()
|
||||
{
|
||||
@@ -278,6 +283,7 @@ public class TreatmentServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>GetActiveTreatmentsByPatient</c> retrieves the full set of active treatments for the specified patient, returning a non-empty collection that includes all expected treatment records identified by their placer order entity identifiers.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=94cf97f body=366612d -->
|
||||
[Test]
|
||||
public async Task GetActiveTreatmentsByPatient()
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace adas_core.Test.Services;
|
||||
/// <remarks>
|
||||
/// This class is intended to contain test methods that validate the behavior and correctness of the UnitService.
|
||||
/// </remarks>
|
||||
/// <!-- aidoc:v1 sig=d7fe647 -->
|
||||
public class UnitServiceTest
|
||||
{
|
||||
private readonly Mock<ILocalAuditService> _auditServiceMock = new();
|
||||
@@ -35,6 +36,7 @@ public class UnitServiceTest
|
||||
/// Initializes mocked dependencies and a configured <see cref="UnitService"/> instance for each test,
|
||||
/// including a mock <see cref="HttpContext"/> with a test user claim.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=d8eb19f body=9422220 -->
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
@@ -72,6 +74,7 @@ public class UnitServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the unit service returns all units retrieved from the repository, including the correct count and content.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=646f078 body=e817121 -->
|
||||
[Test]
|
||||
public async Task GetAll_ShouldReturnAllUnits()
|
||||
{
|
||||
@@ -91,6 +94,7 @@ public class UnitServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the Get method on the unit service returns the expected unit when a valid identifier is provided.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=0b84cdc body=a6e9915 -->
|
||||
[Test]
|
||||
public async Task Get_ShouldReturnUnitById()
|
||||
{
|
||||
@@ -110,6 +114,7 @@ public class UnitServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the Get method retrieves a unit by name when the provided identifier is not a valid ObjectId, matching against either the unit's Title or Name.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=27de124 body=d6052b8 -->
|
||||
[Test]
|
||||
public async Task Get_ShouldReturnUnitByName_WhenIdIsNotObjectId()
|
||||
{
|
||||
@@ -135,6 +140,7 @@ public class UnitServiceTest
|
||||
/// Verifies that _unitService" returns all units retrieved from the repository,
|
||||
/// ensuring the result is not null, contains the expected number of units, and matches the source data.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=58385af body=4797f02 -->
|
||||
[Test]
|
||||
public async Task GetAllUnits_ShouldReturnAllUnits()
|
||||
{
|
||||
@@ -159,6 +165,7 @@ public class UnitServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that _unitService.FindById" returns the matching <see cref="Unit"/> when the repository locates it by id.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=4ba7a3f body=5b6115c -->
|
||||
[Test]
|
||||
public async Task GetUnitById_ShouldReturnUnit_WhenFound()
|
||||
{
|
||||
@@ -179,6 +186,7 @@ public class UnitServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>GetByName</c> returns the matching unit when a unit with the specified name exists in the repository.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f3d4d6c body=e6fef50 -->
|
||||
[Test]
|
||||
public async Task GetUnitByName_ShouldReturnUnit_WhenFound()
|
||||
{
|
||||
@@ -199,6 +207,7 @@ public class UnitServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>FindByPatientId</c> returns the associated unit when the patient is found in an active (in-use) point of care.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=c94d17c body=783cf46 -->
|
||||
[Test]
|
||||
public async Task FindUnitByPatientId_ShouldReturnUnit_WhenPatientFoundInActivePoC()
|
||||
{
|
||||
@@ -229,6 +238,7 @@ public class UnitServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the unit service returns the matching units retrieved from the repository when a call is made to find units by the specified master list identifier and type.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=43926cf body=5d4a6ea -->
|
||||
[Test]
|
||||
public async Task FindUnitsByMasterListId_ShouldReturnUnits_WhenUnitsFound()
|
||||
{
|
||||
@@ -255,6 +265,7 @@ public class UnitServiceTest
|
||||
/// Verifies that the unit service returns the matching units when the repository contains units
|
||||
/// whose point of care matches the specified patient location.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f8afd28 body=15ba7bb -->
|
||||
[Test]
|
||||
public async Task FindByLocation_ShouldReturnUnits_WhenUnitsFound()
|
||||
{
|
||||
@@ -282,6 +293,7 @@ public class UnitServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that FindByLocation returns an empty list when no units match the specified patient location.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=fd09042 body=3dd5efa -->
|
||||
[Test]
|
||||
public async Task FindByLocation_ShouldReturnEmptyList_WhenNoUnitsFound()
|
||||
{
|
||||
@@ -301,6 +313,7 @@ public class UnitServiceTest
|
||||
/// Verifies that the unit service returns the expected unit when a valid unit identifier is provided.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous test execution.</returns>
|
||||
/// <!-- aidoc:v1 sig=bd2f214 body=ccde6a3 -->
|
||||
[Test]
|
||||
public async Task FindById_ShouldReturnUnit_WhenValidIdProvided()
|
||||
{
|
||||
@@ -321,6 +334,7 @@ public class UnitServiceTest
|
||||
/// Verifies that the unit service's FindById method returns null when invoked with a null identifier,
|
||||
/// ensuring graceful handling of null input without throwing or returning a default entity.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=74278e6 body=91cce5c -->
|
||||
[Test]
|
||||
public async Task FindById_ShouldReturnNull_WhenNullIdProvided()
|
||||
{
|
||||
@@ -336,6 +350,7 @@ public class UnitServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that FindByName retrieves and returns the expected <c>Unit</c> when a valid unit name is provided.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=25b0fc0 body=3bf0b69 -->
|
||||
[Test]
|
||||
public async Task FindByName_ShouldReturnUnit_WhenValidNameProvided()
|
||||
{
|
||||
@@ -356,6 +371,7 @@ public class UnitServiceTest
|
||||
/// <summary>
|
||||
/// Verifies that the unit service correctly delegates the insert operation to the repository and returns the inserted unit entity unchanged.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=24b4720 body=83a8f91 -->
|
||||
[Test]
|
||||
public async Task InsertOne_ShouldReturnInsertedUnit()
|
||||
{
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace adas_core.Test.Utilities;
|
||||
/// Provides a <see cref="TestFixtureAttribute"/> that validates the behavior of <see cref="CacheKeyClassifier"/>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=417f7b7 -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "The class is a [TestFixture] test class, not something that 'provides a TestFixtureAttribute'. The summary mischaracterizes the class as providing an attribute rather than being a test fixture for CacheKeyClassifier." -->
|
||||
[TestFixture]
|
||||
public class CacheKeyClassifierTest
|
||||
{
|
||||
@@ -20,6 +22,7 @@ public class CacheKeyClassifierTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="CacheKeyClassifier.Classify"/> returns <see cref="CacheEnum.EntityType.Patients"/> when the cache key starts with the "patients" prefix.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=682114d body=31a0933 -->
|
||||
[Test]
|
||||
public void Classify_ReturnsPatients_ForKeyStartingWithPatients()
|
||||
{
|
||||
@@ -37,6 +40,7 @@ public class CacheKeyClassifierTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="CacheKeyClassifier.Classify"/> returns <see cref="CacheEnum.EntityType.Patients"/> when the cache key starts with the "patients:xyz:" prefix.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=9e918d0 body=93ae134 -->
|
||||
[Test]
|
||||
public void Classify_ReturnsPatients_ForKeyStartingWithPatientsXYZ()
|
||||
{
|
||||
@@ -59,6 +63,7 @@ public class CacheKeyClassifierTest
|
||||
/// Verifies that <see cref="CacheKeyClassifier.Classify"/> correctly returns <see cref="CacheEnum.EntityType.Displays"/>
|
||||
/// for a cache key matching the "configDisplays:display:<id>:base" pattern.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b17fa26 body=686712a -->
|
||||
[Test]
|
||||
public void Classify_ReturnsDisplays_ForKeyStartingWithConfigDisplaysBase()
|
||||
{
|
||||
@@ -77,6 +82,7 @@ public class CacheKeyClassifierTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="CacheKeyClassifier.Classify"/> returns <see cref="CacheEnum.EntityType.Displays"/> when the supplied cache key begins with the <c>configDisplays:</c> prefix.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=3f418e8 body=4bc5ab2 -->
|
||||
[Test]
|
||||
public void Classify_ReturnsDisplays_ForKeyStartingWithConfigDisplaysConfig()
|
||||
{
|
||||
@@ -96,6 +102,7 @@ public class CacheKeyClassifierTest
|
||||
/// Verifies that <see cref="CacheKeyClassifier.Classify"/> returns <see cref="CacheEnum.EntityType.PumpObservations"/>
|
||||
/// when the provided cache key starts with the "pumpObs" prefix.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=9e4e20b body=a0d32c5 -->
|
||||
[Test]
|
||||
public void Classify_ReturnsPumpObservations_ForKeyStartingWithPumpObs()
|
||||
{
|
||||
@@ -115,6 +122,7 @@ public class CacheKeyClassifierTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="CacheKeyClassifier.Classify"/> returns <see cref="CacheEnum.EntityType.Appointments"/> when the cache key starts with the "appointments:patient:" prefix.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=8ad1d4a body=138973c -->
|
||||
[Test]
|
||||
public void Classify_ReturnsAppointments_ForKeyStartingWithAppointmentsPatient()
|
||||
{
|
||||
@@ -131,6 +139,7 @@ public class CacheKeyClassifierTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="CacheKeyClassifier.Classify"/> returns <see cref="CacheEnum.EntityType.Appointments"/> when the provided cache key begins with the "appointments:PoC:" segment.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=372b44b body=783ce44 -->
|
||||
[Test]
|
||||
public void Classify_ReturnsAppointments_ForKeyStartingWithAppointmentsPoc()
|
||||
{
|
||||
@@ -149,6 +158,7 @@ public class CacheKeyClassifierTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="CacheKeyClassifier.Classify"/> returns <see cref="CacheEnum.EntityType.GroupedObservations"/> for cache keys that begin with the "groupedObs:" prefix, such as those following the "groupedObs:HR:patient:{id}" pattern.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=db0234b body=f719cc7 -->
|
||||
[Test]
|
||||
public void Classify_ReturnsGroupedObservations_ForKeyStartingWithGroupedObs()
|
||||
{
|
||||
@@ -167,6 +177,7 @@ public class CacheKeyClassifierTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="CacheKeyClassifier.Classify"/> returns <see cref="CacheEnum.EntityType.ConfigObservations"/> when the supplied cache key starts with the <c>configObservations:</c> prefix.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=72d4f5d body=244b707 -->
|
||||
[Test]
|
||||
public void Classify_ReturnsConfigObservations_ForKeyStartingWithConfigObservations()
|
||||
{
|
||||
@@ -185,6 +196,7 @@ public class CacheKeyClassifierTest
|
||||
/// <summary>
|
||||
/// Verifies that the cache key classifier returns <see cref="CacheEnum.EntityType.Unknown"/> when a key has a prefix that is not recognized.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=3a63e58 body=da49c26 -->
|
||||
[Test]
|
||||
public void Classify_ReturnsUnknown_ForUnrecognizedPrefixDiagnostics()
|
||||
{
|
||||
@@ -201,6 +213,7 @@ public class CacheKeyClassifierTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="CacheKeyClassifier.Classify"/> returns <see cref="CacheEnum.EntityType.Unknown"/> when the supplied cache key uses an unrecognized prefix.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=b3af5e5 body=b0ec253 -->
|
||||
[Test]
|
||||
public void Classify_ReturnsUnknown_ForUnrecognizedPrefixRandom()
|
||||
{
|
||||
@@ -219,6 +232,7 @@ public class CacheKeyClassifierTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="CacheKeyClassifier.Classify"/> returns <see cref="CacheEnum.EntityType.Patients"/> when the cache key is provided in upper case.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=77738e5 body=9bf0d62 -->
|
||||
[Test]
|
||||
public void Classify_ReturnsPatients_ForKeyInUpperCase()
|
||||
{
|
||||
@@ -235,6 +249,7 @@ public class CacheKeyClassifierTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="CacheKeyClassifier.Classify"/> correctly returns the <see cref="CacheEnum.EntityType.Appointments"/> entity type when the supplied cache key contains a mixture of uppercase and lowercase characters, confirming that key classification is case-insensitive.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=7902c13 body=b3cc6f8 -->
|
||||
[Test]
|
||||
public void Classify_ReturnsAppointments_ForKeyInMixedCase()
|
||||
{
|
||||
@@ -253,6 +268,7 @@ public class CacheKeyClassifierTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="CacheKeyTtl.ResolveForEntity"/> returns <c>null</c> when the global cache is disabled, regardless of the configured entity-specific cache mode and Redis TTL settings.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=c5b16e1 body=08452e0 -->
|
||||
[Test]
|
||||
public void ResolveForEntity_ReturnsNull_WhenGlobalCacheDisabled()
|
||||
{
|
||||
@@ -278,6 +294,7 @@ public class CacheKeyClassifierTest
|
||||
/// Verifies that <see cref="CacheKeyTtl.ResolveForEntity"/> returns <c>null</c> for every supported entity type
|
||||
/// when caching is globally disabled via <see cref="CacheSettings.IsEnabled"/> set to <c>false</c>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=8ed737f body=f05fcd5 -->
|
||||
[Test]
|
||||
public void ResolveForEntity_ReturnsNull_WhenGlobalDisabled_ForAllEntities()
|
||||
{
|
||||
@@ -310,6 +327,7 @@ public class CacheKeyClassifierTest
|
||||
/// Verifies that <see cref="CacheKeyTtl.ResolveForEntity"/> returns <c>null</c> when the
|
||||
/// entity mode is set to <see cref="CacheEnum.Mode.None"/>, regardless of the in-memory TTL configuration.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=89b8b65 body=fc6e1ca -->
|
||||
[Test]
|
||||
public void ResolveForEntity_ReturnsNull_WhenEntityModeIsNone()
|
||||
{
|
||||
@@ -338,6 +356,7 @@ public class CacheKeyClassifierTest
|
||||
/// (configured via <c>PatientsSeconds</c>) when the cache mode for the entity is set to
|
||||
/// <see cref="CacheEnum.Mode.Cache"/>, instead of falling back to the global TTL.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=98497f6 body=3120a51 -->
|
||||
[Test]
|
||||
public void ResolveForEntity_UsesEntitySpecificTtl_WhenModeIsCache()
|
||||
{
|
||||
@@ -370,6 +389,7 @@ public class CacheKeyClassifierTest
|
||||
/// Verifies that <see cref="CacheKeyTtl.ResolveForEntity"/> returns the entity-specific Redis TTL (AppointmentsSeconds)
|
||||
/// when the cache mode for the entity is set to <see cref="CacheEnum.Mode.Redis"/>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=86e80e5 body=ce8846d -->
|
||||
[Test]
|
||||
public void ResolveForEntity_UsesRedisTtl_WhenModeIsRedis()
|
||||
{
|
||||
@@ -401,6 +421,7 @@ public class CacheKeyClassifierTest
|
||||
/// Verifies that <see cref="CacheKeyTtl.ResolveForEntity"/> falls back to the globally configured TTL
|
||||
/// (in seconds) when no entity-specific TTL is defined for the requested entity type.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=157850d body=dd84505 -->
|
||||
[Test]
|
||||
public void ResolveForEntity_UsesGlobalSeconds_WhenNoEntitySpecificTtl()
|
||||
{
|
||||
@@ -431,6 +452,7 @@ public class CacheKeyClassifierTest
|
||||
/// <summary>
|
||||
/// Verifies that <c>CacheKeyTtl.ResolveForEntity</c> returns <c>null</c> when the provided <c>CacheSettings</c> enable caching for the entity but no TTL values are configured (neither <c>GlobalSeconds</c> nor the entity-specific seconds).
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=e16d5fc body=7d627cf -->
|
||||
[Test]
|
||||
public void ResolveForEntity_ReturnsNull_WhenNoTtlConfigured()
|
||||
{
|
||||
@@ -461,6 +483,7 @@ public class CacheKeyClassifierTest
|
||||
/// and the Appointments mode is set to <see cref="CacheEnum.Mode.Cache"/>.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="void"/> method; assertions are used to validate the generated key and TTL values.</returns>
|
||||
/// <!-- aidoc:v1 sig=afa01f3 body=7781a0d -->
|
||||
[Test]
|
||||
public void PatientAppointmentsTodayKeyWithTtl_GeneratesCorrectFormat()
|
||||
{
|
||||
@@ -491,6 +514,7 @@ public class CacheKeyClassifierTest
|
||||
/// Verifies that <see cref="CacheKeys.PocAppointmentsTodayKeyWithTtl"/> generates the expected cache key format
|
||||
/// ("appointments:PoC:{pocId}:{yyyyMMdd}") and returns the TTL value configured for point of care entries.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=7eb5c8c body=1ba3125 -->
|
||||
[Test]
|
||||
public void PocAppointmentsTodayKeyWithTtl_GeneratesCorrectFormat()
|
||||
{
|
||||
@@ -520,6 +544,7 @@ public class CacheKeyClassifierTest
|
||||
/// <summary>
|
||||
/// Verifies that <see cref="CacheKeys.LatestObservationsKeyWithTtl"/> generates a deterministic cache key by sorting the supplied field names alphabetically, regardless of their input order.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=4aa88c5 body=13534c8 -->
|
||||
[Test]
|
||||
public void LatestObservationsKeyWithTtl_SortsFieldNamesAlphabetically()
|
||||
{
|
||||
@@ -544,6 +569,7 @@ public class CacheKeyClassifierTest
|
||||
/// <summary>
|
||||
/// Verifies that the cache key generated by <see cref="CacheKeys.LatestObservationsKeyWithTtl"/> excludes empty strings and null entries from the provided observation types, producing a clean delimiter-separated key for the remaining valid values.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=74800d4 body=25a1447 -->
|
||||
[Test]
|
||||
public void LatestObservationsKeyWithTtl_ExcludesEmptyFields()
|
||||
{
|
||||
@@ -567,6 +593,7 @@ public class CacheKeyClassifierTest
|
||||
/// using the "configDisplays:display:{displayId}:base" format and returns the TTL value
|
||||
/// configured in the in-memory cache settings.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=262f298 body=9935dd9 -->
|
||||
[Test]
|
||||
public void DisplayBaseKeyWithTtl_GeneratesCorrectFormat()
|
||||
{
|
||||
@@ -597,6 +624,7 @@ public class CacheKeyClassifierTest
|
||||
/// "configDisplays:display:{displayId}:config" format and that it differs from the base display key
|
||||
/// generated by <see cref="CacheKeys.DisplayBaseKeyWithTtl"/>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=fc7eeb0 body=28787b3 -->
|
||||
[Test]
|
||||
public void DisplayWithConfigKeyWithTtl_GeneratesCorrectFormat()
|
||||
{
|
||||
@@ -619,6 +647,7 @@ public class CacheKeyClassifierTest
|
||||
/// Verifies that <see cref="CacheKeys.PointOfCareBaseKeyWithTtl"/> generates a cache key with the expected
|
||||
/// "pointOfCare:{pocId}:base" format and applies the configured point-of-care TTL in seconds from the in-memory settings.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=f70a5a6 body=a971d77 -->
|
||||
[Test]
|
||||
public void PointOfCareBaseKeyWithTtl_GeneratesCorrectFormat()
|
||||
{
|
||||
@@ -649,6 +678,7 @@ public class CacheKeyClassifierTest
|
||||
/// "configObservations:all" consistently regardless of the supplied <see cref="CacheSettings"/>,
|
||||
/// including when TTL configuration and enabled state differ from defaults.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=617293d body=fd0040a -->
|
||||
[Test]
|
||||
public void ConfigObservationsAllKeyWithTtl_GeneratesCorrectFormat()
|
||||
{
|
||||
@@ -684,6 +714,7 @@ public class CacheKeyClassifierTest
|
||||
/// </summary>
|
||||
/// <param name="entity">The entity type under test for which a cache key pattern is requested.</param>
|
||||
/// <param name="expectedPattern">The cache key pattern that <see cref="CacheKeyPatterns.ForEntity"/> is expected to return for the given entity type.</param>
|
||||
/// <!-- aidoc:v1 sig=706f531 body=4554e7e -->
|
||||
[TestCase(CacheEnum.EntityType.Patients, "patients:*")]
|
||||
[TestCase(CacheEnum.EntityType.Displays, "displays:*")]
|
||||
[TestCase(CacheEnum.EntityType.PumpObservations, "pumpObs:*")]
|
||||
@@ -706,6 +737,7 @@ public class CacheKeyClassifierTest
|
||||
/// that embeds both the supplied prefix and patient identifier, producing the expected
|
||||
/// format of <c>{prefix}:*:{patientId}*</c>.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=946de85 body=59ea43e -->
|
||||
[Test]
|
||||
public void ByPatient_ReturnsPatternContainingPrefixAndPatientId()
|
||||
{
|
||||
@@ -724,6 +756,7 @@ public class CacheKeyClassifierTest
|
||||
/// patient-specific pattern built via <c>CacheKeyPatterns.ByPatient</c>, leaving entries
|
||||
/// belonging to other patients and unrelated entity types intact, and reports the count of deleted keys.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=a914f8e body=de483fe -->
|
||||
[Test]
|
||||
public async Task ByPatient_DeleteByPatternAsync_OnlyRemovesMatchingPatientKeys()
|
||||
{
|
||||
|
||||
@@ -10,12 +10,14 @@ namespace adas_core.Test.Utilities;
|
||||
/// <summary>
|
||||
/// Provides a collection of utility members to support testing operations and helper functionality.
|
||||
/// </summary>
|
||||
/// <!-- aidoc:v1 sig=cfa891c -->
|
||||
public class TestUtilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates and returns a fully populated, valid <see cref="PointOfCare"/> instance with predefined test values, typically used as a helper for unit testing or seeding sample data.
|
||||
/// </summary>
|
||||
/// <returns>A new <see cref="PointOfCare"/> object initialized with valid identifiers, room and bed information, an available status, a default configuration, and a referenced unit.</returns>
|
||||
/// <!-- aidoc:v1 sig=154b0c7 body=e5193dc -->
|
||||
public static PointOfCare CreateValidPointOfCare()
|
||||
{
|
||||
return new PointOfCare
|
||||
@@ -36,6 +38,7 @@ public class TestUtilities
|
||||
/// Creates a valid <see cref="Discharge"/> instance populated with generated identifiers, current UTC timestamps, and default test values for use in test scenarios.
|
||||
/// </summary>
|
||||
/// <returns>A fully populated <see cref="Discharge"/> object with all required fields set to valid values.</returns>
|
||||
/// <!-- aidoc:v1 sig=37702fe body=ccb1310 -->
|
||||
public static Discharge CreateValidDischarge()
|
||||
{
|
||||
return new Discharge
|
||||
@@ -59,6 +62,7 @@ public class TestUtilities
|
||||
/// Creates and returns a new <see cref="Patient"/> instance populated with valid test/default values, including a generated identifier, sample patient numbers, admission timestamp, and related option list entries for discharge status, altable, and origin.
|
||||
/// </summary>
|
||||
/// <returns>A fully initialized <see cref="Patient"/> object suitable for use in testing or seeding scenarios.</returns>
|
||||
/// <!-- aidoc:v1 sig=1ae0cc0 body=cd990fb -->
|
||||
public static Patient CreateValidPatient()
|
||||
{
|
||||
return new Patient
|
||||
@@ -105,6 +109,7 @@ public class TestUtilities
|
||||
/// Creates a new <see cref="OptionList"/> instance populated with predefined valid test values, typically used as a helper for unit tests or test data seeding.
|
||||
/// </summary>
|
||||
/// <returns>An <see cref="OptionList"/> with sample values, where <c>InitDate</c> is set to the current UTC time and <c>EndDate</c> is set to one day after the current UTC time.</returns>
|
||||
/// <!-- aidoc:v1 sig=800f5e4 body=81a25fa -->
|
||||
public static OptionList CreateValidOptionList()
|
||||
{
|
||||
return new OptionList
|
||||
@@ -123,6 +128,7 @@ public class TestUtilities
|
||||
/// Creates a valid <see cref="PatientLocation"/> instance populated with default test data for use in test scenarios.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="PatientLocation"/> with predefined unit name, bed, and room values.</returns>
|
||||
/// <!-- aidoc:v1 sig=c28fe25 body=15ca463 -->
|
||||
private static PatientLocation CreateValidPatientLocation()
|
||||
{
|
||||
return new PatientLocation
|
||||
@@ -137,6 +143,7 @@ public class TestUtilities
|
||||
/// Creates a new <see cref="Unit"/> instance populated with valid default values, typically used for testing or seeding purposes.
|
||||
/// </summary>
|
||||
/// <returns>A new <see cref="Unit"/> object with a generated unique identifier, default title and name, no last update timestamp, an empty list of point of care IDs, an OK status, and a configuration with auto ADT enabled.</returns>
|
||||
/// <!-- aidoc:v1 sig=ecd91da body=ab80ac1 -->
|
||||
public static Unit CreateValidUnit()
|
||||
{
|
||||
return new Unit
|
||||
@@ -158,6 +165,7 @@ public class TestUtilities
|
||||
/// Creates and returns a valid <see cref="Admission"/> instance populated with sample test data, including generated unique identifiers, a test person, option lists for origin, diagnosis, insulation, language barrier, allergies, and a patient location.
|
||||
/// </summary>
|
||||
/// <returns>A new <see cref="Admission"/> object fully initialized with valid test values.</returns>
|
||||
/// <!-- aidoc:v1 sig=2ea4b69 body=37f7713 -->
|
||||
public static Admission CreateValidAdmission()
|
||||
{
|
||||
return new Admission
|
||||
@@ -195,6 +203,7 @@ public class TestUtilities
|
||||
/// </summary>
|
||||
/// <param name="id">The optional identifier for the configuration. If <c>null</c>, a new <see cref="ObjectId"/> is generated.</param>
|
||||
/// <returns>A newly created <see cref="CardConfig"/> populated with the default valid configuration.</returns>
|
||||
/// <!-- aidoc:v1 sig=7d0e8fd body=d62f12a -->
|
||||
public static CardConfig CreateValidCardConfig(ObjectId? id = null)
|
||||
{
|
||||
return new CardConfig
|
||||
@@ -220,6 +229,7 @@ public class TestUtilities
|
||||
/// </summary>
|
||||
/// <param name="id">The optional identifier to assign to the configuration. When <c>null</c>, a new <see cref="ObjectId"/> is generated.</param>
|
||||
/// <returns>A <see cref="CardDetailsConfig"/> populated with the nurse display configuration.</returns>
|
||||
/// <!-- aidoc:v1 sig=b545d8d body=a2d6d5b -->
|
||||
public static CardDetailsConfig CreateValidCardDetailsNurseConfig(ObjectId? id = null)
|
||||
{
|
||||
return new CardDetailsConfig
|
||||
@@ -259,6 +269,7 @@ public class TestUtilities
|
||||
/// </summary>
|
||||
/// <param name="id">The optional identifier to assign to the configuration. When <c>null</c>, a new <see cref="ObjectId"/> is generated.</param>
|
||||
/// <returns>A <see cref="CardDetailsConfig"/> configured with a predefined smart section layout.</returns>
|
||||
/// <!-- aidoc:v1 sig=ea55729 body=77525b6 -->
|
||||
public static CardDetailsConfig CreateValidCardDetailsSmartConfig(ObjectId? id = null)
|
||||
{
|
||||
return new CardDetailsConfig
|
||||
@@ -301,6 +312,7 @@ public class TestUtilities
|
||||
/// <param name="idCard">The optional card config identifier. A new <see cref="ObjectId"/> is generated when <c>null</c>.</param>
|
||||
/// <param name="idDetail">The optional detail config identifier. A new <see cref="ObjectId"/> is generated when <c>null</c>.</param>
|
||||
/// <returns>A fully populated <see cref="DisplayConfig"/> with default field and hospital values.</returns>
|
||||
/// <!-- aidoc:v1 sig=8e7f94f body=bd71343 -->
|
||||
public static DisplayConfig CreateValidDisplayConfig(DisplayConfigEnums.DisplayType type, ObjectId? id,
|
||||
ObjectId? idCard, ObjectId? idDetail)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user