Documentation modifications

This commit is contained in:
julian
2026-06-27 15:23:26 -07:00
parent a633fe6c06
commit a19fb90902
218 changed files with 2882 additions and 0 deletions
@@ -38,6 +38,10 @@ public class AdmissionServiceTest
private Mock<ISubscribersService> _subscribersServiceMock;
private Mock<IUnitService> _unitServiceMock;
/// <summary>
/// Initializes mocked dependencies and constructs an <see cref="AdmissionService"/> instance for use in unit tests, configuring a mock <see cref="IHttpContextAccessor"/> with an authenticated test user.
/// </summary>
/// <!-- aidoc:v1 sig=dee8bf2 body=4512c25 -->
[SetUp]
public void Setup()
{
@@ -44,6 +44,10 @@ public class AlarmServiceTest
private readonly RecordingSettings _recordingSettings = new();
private readonly Mock<IUnitService> _unitServiceMock;
/// <summary>
/// Initializes a test fixture that exercises <see cref="AlarmService"/>. The fixture configures mocked collaborators (such as <see cref="IAlarmRepository"/>, <see cref="IObservationService"/>, <see cref="IPatientService"/>, and <see cref="ILogger{AlarmService}"/>) and constructs an <see cref="AlarmService"/> instance with the background timer disabled for testing.
/// </summary>
/// <!-- aidoc:v1 sig=e109274 body=c40c5e2 -->
public AlarmServiceTest()
{
var optionsApiSettings = Options.Create(_apiSettings);
@@ -42,6 +42,10 @@ public class FakeLockProvider : ILockProvider
/// </remarks>
public class FakeLockManagerService : LockManagerService
{
/// <summary>
/// Initializes a new instance of <see cref="FakeLockManagerService"/>, a test fake of <see cref="LockManagerService"/>, by forwarding a mocked <see cref="ILogger{LockManagerService}"/> and a <see cref="FakeLockProvider"/> to the base constructor.
/// </summary>
/// <!-- aidoc:v1 sig=1d9bbc1 body=4448e1d -->
public FakeLockManagerService() : base(
Mock.Of<ILogger<LockManagerService>>(),
new FakeLockProvider())
@@ -61,6 +65,10 @@ public class FakeRedisService : RedisService, ICacheService
public bool WasCalled { get; private set; }
public string? LastKey { get; private set; }
/// <summary>
/// Initializes a new instance of <see cref="FakeRedisService"/>, a test double for <see cref="RedisService"/>, supplying default <see cref="CacheSettings"/>, a mocked <see cref="ILogger{RedisService}"/>, and a <see cref="FakeLockManagerService"/> to the base constructor.
/// </summary>
/// <!-- aidoc:v1 sig=82d8847 body=4448e1d -->
public FakeRedisService() : base(
Options.Create(new CacheSettings()),
Mock.Of<ILogger<RedisService>>(),
@@ -123,10 +131,23 @@ public class FakeCacheService : CacheService, ICacheService
public bool WasCalled { get; private set; }
public string? LastKey { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="FakeCacheService"/> test double, supplying a newly created <see cref="FakeLockManagerService"/> to the base cache service as its lock-management dependency.
/// </summary>
/// <!-- aidoc:v1 sig=e01af03 body=4448e1d -->
public FakeCacheService() : base(new FakeLockManagerService())
{
}
/// <summary>
/// Stub implementation of <see cref="ICacheService.GetOrSetObjectAsync{T}"/> that records the invocation and the supplied key without performing any caching, and returns the value produced by <paramref name="factory"/>.
/// </summary>
/// <param name="key">The cache key under which the value would be stored; recorded for later verification.</param>
/// <param name="factory">The <see cref="Func{Task{T}}"/> invoked to produce the value returned by this method.</param>
/// <param name="ttl">Optional time-to-live for the cache entry; ignored by this implementation.</param>
/// <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 -->
Task<T> ICacheService.GetOrSetObjectAsync<T>(
string key,
Func<Task<T>> factory,
@@ -138,6 +159,17 @@ public class FakeCacheService : CacheService, ICacheService
return factory();
}
/// <summary>
/// Retrieves an object from the cache for the given <paramref name="groupedField"/> and <paramref name="patientId"/>, or produces it via <paramref name="factory"/> when no cached entry exists. This implementation unconditionally invokes <paramref name="factory"/> and records the call by setting <see cref="WasCalled"/> to <c>true</c>, ignoring any cached value and the <paramref name="ttl"/>.
/// </summary>
/// <typeparam name="T">The type of the object being retrieved or created.</typeparam>
/// <param name="groupedField">The grouped field used as part of the cache lookup key.</param>
/// <param name="patientId">The patient identifier used as part of the cache lookup key.</param>
/// <param name="factory">The asynchronous factory invoked to produce the value when no cached entry is available.</param>
/// <param name="ttl">An optional time-to-live for the cached entry. Not used by this implementation.</param>
/// <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 -->
Task<T> ICacheService.GetOrSetObjectAsync<T>(
GroupedField groupedField,
ObjectId patientId,
@@ -186,6 +218,10 @@ public class FakeNoCacheService : NoCacheService, ICacheService
}
/// <summary>
/// Represents a test fixture that exercises the <see cref="CacheDispatcher"/> to validate its expected runtime behavior.
/// </summary>
/// <!-- aidoc:v1 sig=e92eb06 -->
[TestFixture]
public class CacheDispatcherTest
{
@@ -216,6 +252,10 @@ public class CacheDispatcherTest
#region TC-23
/// <summary>
/// Verifies that GetOrSetObjectAsync uses the Redis service when the patients cache mode is configured as <see cref="CacheEnum.Mode.Redis"/>, and does not fall back to the memory or no-op cache services.
/// </summary>
/// <!-- aidoc:v1 sig=3f07bc5 body=9d2c439 -->
[Test]
public async Task GetOrSetObjectAsync_UsesRedisService_WhenPatientsModeIsRedis()
{
@@ -238,6 +278,10 @@ public class CacheDispatcherTest
#endregion
#region TC-24
/// <summary>
/// Verifies that <see cref="CacheDispatcher.GetOrSetObjectAsync{T}"/> delegates to the in-memory cache service when <see cref="CacheSettings.Appointments"/> is set to <see cref="CacheEnum.Mode.Cache"/>, forwarding the supplied key and ensuring that neither the Redis nor the no-op cache implementations are invoked in this scenario.
/// </summary>
/// <!-- aidoc:v1 sig=69efd2a body=e0ce152 -->
[Test]
public async Task GetOrSetObjectAsync_UsesCacheService_WhenAppointmentsModeIsCache()
{
@@ -260,6 +304,10 @@ public class CacheDispatcherTest
#endregion
#region TC-25
/// <summary>
/// Verifies that <see cref="CacheDispatcher.GetOrSetObjectAsync"/> delegates to the no-op cache service and skips both the Redis and in-memory cache services when <see cref="CacheSettings.PumpObservations"/> is configured with <see cref="CacheEnum.Mode.None"/>.
/// </summary>
/// <!-- aidoc:v1 sig=c516b35 body=f3aa2f5 -->
[Test]
public async Task GetOrSetObjectAsync_UsesNoCacheService_WhenPumpObservationsModeIsNone()
{
@@ -282,6 +330,13 @@ public class CacheDispatcherTest
#endregion
#region TC-26
/// <summary>
/// Verifies that <see cref="GetOrSetObjectAsync{T}(string, Func{Task{T}})"/> falls back to the InMemory cache service
/// when the provided cache key has an unrecognized prefix, ensuring that unknown keys are still served by the default
/// cache implementation rather than the <see cref="IRedisCacheService"/> or <see cref="INoCacheService"/>.
/// </summary>
/// <returns>A <see cref="Task"/> that completes when the fallback behavior has been validated through the assertions.</returns>
/// <!-- aidoc:v1 sig=b24df70 body=15e546d -->
[Test]
public async Task GetOrSetObjectAsync_UsesCacheService_WhenKeyIsUnrecognized()
{
@@ -2,6 +2,13 @@ namespace adas_core.Test.Services;
using adas_core.Application.Services.Caching;
using Microsoft.Extensions.Logging;
using Moq;
/// <summary>
/// Provides a test fixture containing unit tests for the CacheService class.
/// </summary>
/// <remarks>
/// The <see cref="NUnit.Framework.TestFixtureAttribute"/> indicates that this class groups related test methods executed by the NUnit testing framework.
/// </remarks>
/// <!-- aidoc:v1 sig=90bb100 -->
[TestFixture]
public class CacheServiceTest
{
@@ -21,6 +28,10 @@ public class CacheServiceTest
_svc = new CacheService(lockMgr);
}
#region TC-31
/// <summary>
/// Verifies that GetOrSetObjectAsync returns the previously cached value for a key that already exists in the cache and does not invoke the factory delegate.
/// </summary>
/// <!-- aidoc:v1 sig=57477a5 body=20c4a7a -->
[Test]
public async Task GetOrSetObjectAsync_ReturnsCachedValue_AndDoesNotInvokeFactory_WhenKeyAlreadyExists()
{
@@ -1,5 +1,9 @@
namespace adas_core.Test.Services;
/// <summary>
/// Serves as a test fixture that contains unit tests for the <see cref="CameraService"/> class.
/// </summary>
/// <!-- aidoc:v1 sig=a7f21ae -->
[TestFixture]
internal class CameraServiceTest
{
@@ -16,6 +16,10 @@ using Options = Microsoft.Extensions.Options.Options;
namespace adas_core.Test.Services;
/// <summary>
/// Provides unit tests for the <see cref="ConfigObservationService"/> class.
/// </summary>
/// <!-- aidoc:v1 sig=b67849b -->
[TestFixture]
public class ConfigObservationServiceTest
{
@@ -14,6 +14,13 @@ using Options = Microsoft.Extensions.Options.Options;
namespace adas_core.Test.Services;
/// <summary>
/// Serves as a test fixture containing unit tests for the <see cref="ConfigPumpsService"/> class.
/// </summary>
/// <remarks>
/// Marked with the NUnit <see cref="TestFixtureAttribute"/> to group and execute the test methods that validate the behavior of <see cref="ConfigPumpsService"/>.
/// </remarks>
/// <!-- aidoc:v1 sig=9b5acf0 -->
[TestFixture]
public class ConfigPumpsServiceTest
{
@@ -10,6 +10,10 @@ using Options = Microsoft.Extensions.Options.Options;
namespace adas_core.Test.Services;
/// <summary>
/// Provides unit tests for the <see cref="ConfigUnitsService"/> class.
/// </summary>
/// <!-- aidoc:v1 sig=9068864 -->
[TestFixture]
public class ConfigUnitsServiceTest
{
@@ -14,6 +14,10 @@ using Options = Microsoft.Extensions.Options.Options;
namespace adas_core.Test.Services;
/// <summary>
/// Defines a test fixture containing unit tests that verify the behavior of the DiagnosisService.
/// </summary>
/// <!-- aidoc:v1 sig=bc1cd44 -->
[TestFixture]
public class DiagnosisServiceTest
{
@@ -213,6 +217,10 @@ public class DiagnosisServiceTest
_diagnosisRepositoryMock.Verify(d => d.InsertOneAsync(It.IsAny<PatientDiagnosis>()), Times.Never);
}
/// <summary>
/// Verifies that <see cref="DiagnosisService.SaveRequest"/> does not insert a <see cref="PatientDiagnosis"/> when the supplied <see cref="ApiRequest"/> does not represent diagnosis code settings.
/// </summary>
/// <!-- aidoc:v1 sig=9cdb26c body=11b0c14 -->
[Test]
public async Task SaveRequest_Not_DiagnosisCodeSettings_Return_not_insert()
{
@@ -15,6 +15,13 @@ using Options = Microsoft.Extensions.Options.Options;
namespace adas_core.Test.Services;
/// <summary>
/// Provides a NUnit test fixture that exercises the behavior of the DisplayService class.
/// </summary>
/// <remarks>
/// Marked with <see cref="TestFixtureAttribute"/> so the NUnit test runner can discover and execute the contained test methods.
/// </remarks>
/// <!-- aidoc:v1 sig=cb14af2 -->
[TestFixture]
public class DisplayServiceTest
{
@@ -144,6 +151,12 @@ public class DisplayServiceTest
// GetAllByUser - Admin case
// -----------------------------------------------------------
/// <summary>
/// Verifies that <see cref="DisplayService.GetAllByUser"/> returns all <see cref="Display"/> objects
/// associated with the units the user has authorization over when the user holds the
/// <see cref="PermissionEnum.RolesType.AuthAdmin"/> role.
/// </summary>
/// <!-- aidoc:v1 sig=f3916bd body=50fd0aa -->
[Test]
public async Task GetAllByUser_ShouldReturnDisplays_WhenAdmin()
{
@@ -12,6 +12,10 @@ using static adas_core.Domain.Enums.GroupedObservationEnum;
namespace adas_core.Test.Services;
/// <summary>
/// Represents a NUnit test fixture that verifies the behavior of <see cref="GroupedObservationService"/>.
/// </summary>
/// <!-- aidoc:v1 sig=bf08b6e -->
[TestFixture]
public class GroupedObservationServiceTest
{
@@ -9,6 +9,13 @@ using Moq;
namespace adas_core.Test.Services;
/// <summary>
/// Test fixture that contains unit tests for HistoricalConfigChangesService.
/// </summary>
/// <remarks>
/// Tests in this fixture are decorated with the NonParallelizable attribute and must not execute concurrently with other tests.
/// </remarks>
/// <!-- aidoc:v1 sig=ae94572 -->
[TestFixture]
[NonParallelizable]
internal class HistoricalConfigChangesServiceTest
@@ -4,6 +4,12 @@ using adas_core.Application.Services.Caching;
namespace adas_core.Test.Services;
/// <summary>
/// NUnit test fixture that exercises the behavior of the in-memory lock provider.
/// </summary>
/// <remarks>
/// The <see cref="TestFixtureAttribute"/> attribute marks this class as a container of related test cases.</remarks>
/// <!-- aidoc:v1 sig=92f2274 -->
[TestFixture]
public class InMemoryLockProviderTest
{
@@ -12,6 +12,13 @@ using Options = Microsoft.Extensions.Options.Options;
namespace adas_core.Test.Services;
/// <summary>
/// Provides a NUnit test fixture for validating the behavior of LightBeaconService.
/// </summary>
/// <remarks>
/// Marked with the <see cref="TestFixtureAttribute"/> attribute, this class groups together unit tests targeting LightBeaconService.
/// </remarks>
/// <!-- aidoc:v1 sig=b588273 -->
[TestFixture]
public class LightBeaconServiceTest
{
@@ -13,6 +13,10 @@ using Moq;
namespace adas_core.Test.Services;
/// <summary>
/// Provides unit tests for the <see cref="MasterListService"/> class, exercising its behavior under the NUnit <see cref="TestFixtureAttribute"/> framework.
/// </summary>
/// <!-- aidoc:v1 sig=a1e1475 -->
[TestFixture]
public class MasterListServiceTest
{
@@ -14,9 +14,17 @@ using Options = Microsoft.Extensions.Options.Options;
namespace adas_core.Test.Services;
/// <summary>
/// Contains unit tests for the <see cref="MedicineService"/> class, verifying its behavior and contracts.
/// </summary>
/// <!-- aidoc:v1 sig=6e8ca9d -->
[TestFixture]
public class MedicineServiceTest
{
/// <summary>
/// Initializes the test dependencies for <see cref="MedicineService"/> unit tests by creating mocks for <see cref="IMedicineRepository"/>, <see cref="ITreatmentService"/>, and <see cref="ILogger{MedicineService}"/>, then constructing the service under test with the required collaborators.
/// </summary>
/// <!-- aidoc:v1 sig=dee8bf2 body=c01c921 -->
[SetUp]
public void Setup()
{
@@ -55,6 +63,11 @@ public class MedicineServiceTest
//private static readonly DateTime now = DateTime.Now;
private static readonly ObjectId PatientId = ObjectId.GenerateNewId();
/// <summary>
/// Verifies that <see cref="MedicineService.GetMedicinesOfTreatments"/> returns an empty result (count of 0) when <see cref="IMedicineRepository.GetMedicineByCodeOrNote"/> yields no <see cref="Medicine"/> items for the supplied <see cref="PatientTreatment"/> entries.
/// </summary>
/// <exception cref="ArgumentNullException">Thrown when the local <see cref="List{PatientTreatment}"/> collection is null.</exception>
/// <!-- aidoc:v1 sig=6587029 body=89ace4d -->
[Test]
public async Task GetMedicinesOfTreatments_Null_Medicine_Return_0()
{
@@ -71,6 +84,11 @@ public class MedicineServiceTest
Assert.That(result.Count(), EqualTo(0));
}
/// <summary>
/// Verifies that <see cref="MedicineService.GetMedicinesOfTreatments"/> returns medicines when the supplied
/// <see cref="List{PatientTreatment}"/> contains codes matching medicines registered in the repository.
/// </summary>
/// <!-- aidoc:v1 sig=9b6ab1e body=dfdcc25 -->
[Test]
public async Task GetMedicinesOfTreatments_Medicines_Return_Medicines()
{
@@ -117,6 +135,10 @@ public class MedicineServiceTest
Assert.That(result.Count(), GreaterThan(0));
}
/// <summary>
/// Tests that <see cref="MedicineService.GetMedicinesOfTreatments"/> returns medicines for a <see cref="PatientTreatment"/> when the medicine repository returns no results for <see cref="MedicineRepository.GetMedicineByCodeOrNote"/>, verifying that the returned medicines contain the identifier and text extracted from <see cref="PatientTreatment.RequestedGiveCodes"/>.
/// </summary>
/// <!-- aidoc:v1 sig=1cd9fc2 body=15ec2c4 -->
[Test]
public async Task GetMedicinesOfTreatments_Not_Get_Medicines_Return_Note_Medicines()
{
@@ -152,6 +174,10 @@ public class MedicineServiceTest
};
}
/// <summary>
/// Verifies that <see cref="MedicineService.GetMedicinesOfTreatments"/> falls back to constructing medicines from the <see cref="PatientTreatment.RequestedGiveCodes"/> text when the medicine repository returns no medicines matching the requested codes.
/// </summary>
/// <!-- aidoc:v1 sig=2beba14 body=6e04063 -->
[Test]
public async Task GetMedicinesOfTreatments_Not_Get_Medicines_Not_Code_identifier_Return_Note_Medicines()
{
@@ -188,6 +214,10 @@ public class MedicineServiceTest
};
}
/// <summary>
/// Verifies that <see cref="MedicineService.GetMedicinesOfTreatments"/> returns an NPT <see cref="Medicine"/> with type <see cref="MedicineEnum.Types.ParenteralNutrition"/> when the <see cref="PatientTreatment"/> notes contain the "NPT" formularybaseformulation comment.
/// </summary>
/// <!-- aidoc:v1 sig=186f001 body=182af67 -->
[Test]
public async Task CalculateParentalNutritionMedicine_Notes_NPT_Return_NPT_Medicine()
{
@@ -226,6 +256,10 @@ public class MedicineServiceTest
};
}
/// <summary>
/// Verifies that when a <see cref="PatientTreatment"/> includes notes indicating "NPT" parenteral nutrition and a lipid formulation comment, <see cref="MedicineService.GetMedicinesOfTreatments"/> resolves the treatment into a <see cref="Medicine"/> named "NPT" of type <see cref="MedicineEnum.Types.ParenteralNutritionLipids"/> with no associated code, even when <see cref="IMedicineRepository.GetMedicineByCodeOrNote"/> returns an empty list.
/// </summary>
/// <!-- aidoc:v1 sig=bfdb93a body=11a42b3 -->
[Test]
public async Task CalculateParentalNutritionMedicine_Notes_NPTL_Return_NPTL_Medicine()
{
@@ -2,6 +2,10 @@ using adas_core.Application.Services.Caching;
namespace adas_core.Test.Services;
/// <summary>
/// Test fixture that validates the behavior of the NoCacheService, ensuring its operations function correctly in a non-caching context.
/// </summary>
/// <!-- aidoc:v1 sig=d79267a -->
[TestFixture]
public class NoCacheServiceTest
{
@@ -19,6 +23,11 @@ public class NoCacheServiceTest
#region TC-27
/// <summary>
/// Verifies that the no-cache implementation of <see cref="GetOrSetObjectAsync"/> always invokes the supplied factory delegate
/// and never returns a previously cached value, even when called repeatedly with the same key.
/// </summary>
/// <!-- aidoc:v1 sig=0ade665 body=93b4d4c -->
[Test]
public async Task GetOrSetObjectAsync_AlwaysCallsFactory_NeverUsesCache()
{
@@ -45,6 +54,10 @@ public class NoCacheServiceTest
Assert.That(result2, Is.EqualTo(expectedResult));
}
/// <summary>
/// Verifies that <c>GetOrSetValueAsync</c> invokes the supplied factory delegate once for every unique key passed in, ensuring that the no-cache implementation does not deduplicate or short-circuit calls based on key uniqueness.
/// </summary>
/// <!-- aidoc:v1 sig=7b6a45d body=15c5c5c -->
[Test]
public async Task GetOrSetObjectAsync_CallsFactory_ForEachUniqueKey()
{
@@ -18,6 +18,10 @@ using Options = Microsoft.Extensions.Options.Options;
namespace adas_core.Test.Services;
/// <summary>
/// Serves as a NUnit test fixture that verifies the behavior of <see cref="ObservationService"/>.
/// </summary>
/// <!-- aidoc:v1 sig=195961f -->
[TestFixture]
public class ObservationServiceTest
{
@@ -159,6 +163,10 @@ public class ObservationServiceTest
private static readonly DateTime Now = DateTime.Now;
private static readonly ObjectId PatientId = ObjectId.GenerateNewId();
/// <summary>
/// Verifies that when an <see cref="ApiRequest"/> contains allergy observations stating that the patient has no known allergies, the observation service does not insert a new <see cref="PatientObservation"/> named "AllergiesObs" for the patient.
/// </summary>
/// <!-- aidoc:v1 sig=6c516f0 body=db4def1 -->
[Test]
public async Task ProcessAllergiesObservation__apiRequest_No_Allergies_Return_Nothing()
{
@@ -229,6 +237,12 @@ public class ObservationServiceTest
)), Times.Never);
}
/// <summary>
/// Verifies that the observation processing pipeline correctly handles an <see cref="ApiRequest"/> containing a latex allergy entry,
/// ensuring that the mapped <see cref="PatientObservation"/> with its <see cref="PatientAllergiesValue"/> list is persisted via the
/// repository's <c>InsertOneAsync</c> call after being resolved through the patient, configuration, and unit services.
/// </summary>
/// <!-- aidoc:v1 sig=28d5b94 body=563ca14 -->
[Test]
public async Task ProcessAllergiesObservation_apiRequest_Allergies_Latex_Return_AllergiesObs_Latex()
{
@@ -328,6 +342,10 @@ public class ObservationServiceTest
_observationRepository.Verify(o => o.InsertOneAsync(expectedObs));
}
/// <summary>
/// Verifies that <see cref="ObservationService.SaveRequest"/> correctly handles an <see cref="ApiRequest"/> of type "ORU_R01" containing allergy-related <see cref="PatientObservation"/> entries, consolidating them into a single <see cref="PatientObservation"/> whose value groups the allergies by type with their allergen and notes, and that the resulting observation is persisted via <see cref="ObservationRepository.InsertOneAsync"/>.
/// </summary>
/// <!-- aidoc:v1 sig=60d4186 body=38528af -->
[Test]
public async Task ProcessAllergiesObservation_apiRequest_Allergies_Return_AllergiesObs()
{
@@ -512,6 +530,10 @@ public class ObservationServiceTest
}
/// <summary>
/// Verifies that <c>SaveRequest</c> processes an <see cref="ApiRequest"/> of type "ORU_R01" carrying drainages-related <see cref="PatientObservation"/> entries (volume, location, type and column height) and persists the resulting <see cref="PatientObservation"/> through the repository insert operation with the mapped <see cref="PatientDrainagesValue"/> collection as its value.
/// </summary>
/// <!-- aidoc:v1 sig=02099ca body=0538544 -->
[Test]
public async Task ProcessDrainagesObservation_apiRequest_Drainages_Return_DrainagesObs()
{
@@ -816,6 +838,10 @@ public class ObservationServiceTest
)));
}
/// <summary>
/// Verifies that <see cref="ObservationService.SaveRequest"/> processes an <c>ORU_R01</c> message containing a SNOMED-coded intravenous line observation (peripheral epicatheter at the right temporal zone) and inserts a <see cref="PatientObservation"/> carrying a <see cref="PatientIntravenousLinesValue"/> with the expected <see cref="PatientObservation.Code"/>, <see cref="PatientObservation.CodingSystem"/>, <see cref="PatientObservation.Time"/>, <see cref="PatientObservation.MessageTime"/>, <see cref="PatientObservation.PatientId"/>, and <see cref="PatientObservation.Value"/>.
/// </summary>
/// <!-- aidoc:v1 sig=d3137cf body=16202aa -->
[Test]
public async Task ProcessIntravenousLinesObservation_Return_PositionObs()
{
@@ -18,6 +18,10 @@ using static NUnit.Framework.Assert;
namespace adas_core.Test.Services;
/// <summary>
/// Serves as the NUnit <see cref="TestFixtureAttribute"/> test class that contains unit tests for <see cref="PatientService"/>.
/// </summary>
/// <!-- aidoc:v1 sig=bf19488 -->
[TestFixture]
internal class PatientServiceTest
{
@@ -1076,6 +1080,10 @@ internal class PatientServiceTest
}
/// <summary>
/// Verifies that an ADT_A02 transfer request for an existing patient targeting a non-existent destination bed moves the patient to a virtual Point of Care flagged as Unknown when <see cref="PointOfCareMapping.Required"/> is disabled.
/// </summary>
/// <!-- aidoc:v1 sig=8f58bf8 body=93b818c -->
[Test]
public async Task ADT_A02_TRANSFER_PATIENT_FROM_EXISTS_BED_TO_NOT_EXISTS_BED_SHOULD_MOVE_TO_VIRTUAL_POC_UNKNOWN()
{
@@ -14,6 +14,13 @@ using Options = Microsoft.Extensions.Options.Options;
namespace adas_core.Test.Services;
/// <summary>
/// Test fixture that exercises the behavior of <see cref="PointOfCareService"/>.
/// </summary>
/// <remarks>
/// Marked with <see cref="TestFixtureAttribute"/> so that the test runner discovers and executes the contained test methods.
/// </remarks>
/// <!-- aidoc:v1 sig=4b0404e -->
[TestFixture]
public class PointOfCareServiceTests
{
@@ -210,6 +217,13 @@ public class PointOfCareServiceTests
Assert.That(result, Is.EqualTo(expectedPointOfCareList));
}
/// <summary>
/// Verifies that <see cref="PointOfCareService.CheckNextAdmission"/> resolves the <see cref="PointOfCare"/> through the cache factory,
/// looks up the next <see cref="Admission"/> when <see cref="PointOfCare.AdmissionId"/> is null, assigns it to the PoC,
/// transitions the <see cref="StatusEnum.PointOfCare"/> status to Reserved, and invokes <see cref="IPointOfCareRepository.Update"/> exactly once,
/// without taking the <c>FindByIdAllConfig</c> code path.
/// </summary>
/// <!-- aidoc:v1 sig=32ec21f body=2809040 -->
[Test]
public void CheckNextAdmission_ValidPatientLocation_UpdatesPoCStatus_AndCallsUpdate()
{
@@ -8,6 +8,10 @@ using Moq;
namespace adas_core.Test.Services;
/// <summary>
/// Provides a test fixture that validates the behavior of the <see cref="PublisherService"/>.
/// </summary>
/// <!-- aidoc:v1 sig=be0a4eb -->
[TestFixture]
public class PublisherServiceTest
{
@@ -17,6 +17,13 @@ using Options = Microsoft.Extensions.Options.Options;
namespace adas_core.Test.Services;
/// <summary>
/// Provides a test fixture for verifying the behavior of the PumpService.
/// </summary>
/// <remarks>
/// This class is decorated with the TestFixture attribute and hosts the unit tests for the PumpService.
/// </remarks>
/// <!-- aidoc:v1 sig=e17ee05 -->
[TestFixture]
public class PumpServiceTest
{
@@ -293,6 +300,10 @@ public class PumpServiceTest
Times.Never);
}
/// <summary>
/// Verifies that <see cref="SaveRequest"/> falls back to <see cref="ApiRequest.Location"/> when the patient cannot be resolved from the API request, broadcasts the resulting <see cref="PumpState"/> to subscribers matching that location, and skips <see cref="OperationType.PumpAlarm"/> messages when no active alarms exist.
/// </summary>
/// <!-- aidoc:v1 sig=b11b322 body=c2ffc92 -->
[Test]
public async Task SaveRequest_WithSubscribers_UsesReqLocation_AndSendsBroadcast()
{
@@ -11,6 +11,10 @@ using Moq;
namespace adas_core.Test.Services;
/// <summary>
/// Provides a test fixture containing unit tests for the <see cref="RecordingAlertService"/> class.
/// </summary>
/// <!-- aidoc:v1 sig=510464c -->
[TestFixture]
public class RecordingAlertServiceTest
{
@@ -16,6 +16,13 @@ using Options = Microsoft.Extensions.Options.Options;
namespace adas_core.Test.Services;
/// <summary>
/// Acts as a NUnit test fixture that validates the behavior of the <see cref="RecordingService"/> class.
/// </summary>
/// <remarks>
/// Marked with <see cref="TestFixtureAttribute"/>, this class groups the unit tests that exercise <see cref="RecordingService"/>.
/// </remarks>
/// <!-- aidoc:v1 sig=967604d -->
[TestFixture]
public class RecordingServiceTest
{
@@ -5,6 +5,13 @@ using StackExchange.Redis;
namespace adas_core.Test.Services;
/// <summary>
/// Represents a test fixture that contains unit tests for the RedisLockProvider class.
/// </summary>
/// <remarks>
/// Decorated with the TestFixture attribute so that NUnit-compatible test runners can discover and execute its test methods.
/// </remarks>
/// <!-- aidoc:v1 sig=cb004e0 -->
[TestFixture]
public class RedisLockProviderTest
{
@@ -9,6 +9,10 @@ using Options = Microsoft.Extensions.Options.Options;
namespace adas_core.Test.Services;
/// <summary>
/// Represents an NUnit <see cref="TestFixtureAttribute"/> containing unit tests that exercise the behavior of the Redis service.
/// </summary>
/// <!-- aidoc:v1 sig=920ae32 -->
[TestFixture]
public class RedisServiceTest
{
@@ -13,6 +13,10 @@ using Options = Microsoft.Extensions.Options.Options;
namespace adas_core.Test.Services;
/// <summary>
/// Provides a NUnit test fixture that contains the unit tests for the RelayService class.
/// </summary>
/// <!-- aidoc:v1 sig=8ce82ad -->
[TestFixture]
public class RelayServiceTest
{
@@ -176,6 +180,10 @@ public class RelayServiceTest
Assert.That(result, Is.EqualTo(RelayEnum.Status.On));
}
/// <summary>
/// Verifies that the relay status check returns <see cref="RelayEnum.Status.Off"/> when the mocked HTTP response indicates the relay is off, after invoking the power-off operation on the supplied <see cref="Relay"/>.
/// </summary>
/// <!-- aidoc:v1 sig=ba0668b body=434ffc5 -->
[Test]
public async Task CheckRelayStatus_Return_Off()
{
@@ -16,9 +16,26 @@ using Options = Microsoft.Extensions.Options.Options;
namespace adas_core.Test.Services;
/// <summary>
/// Contains unit tests that verify the behavior of the <see cref="SchedulerService"/> class.
/// </summary>
/// <remarks>
/// Marked as a test fixture so that the contained test methods are discovered and executed by the test runner.
/// </remarks>
/// <!-- aidoc:v1 sig=97a1147 -->
[TestFixture]
public class SchedulerServiceTest
{
/// <summary>
/// One-time setup that initializes mocked services, lazy wrappers, and test data
/// required to exercise <see cref="SchedulerService"/> along with the Quartz-based
/// news and expiration jobs (<see cref="CalculateNewsJob"/>, <see cref="CheckExpiredAlertsJob"/>,
/// <see cref="CheckExpiredObservationsJob"/>). It configures <see cref="IConfigObservationService"/> and
/// <see cref="IObservationService"/> behaviors to match observations by name and patient, and the
/// <see cref="IPatientService"/> to return the predefined patient list from
/// <see cref="IPatientService.FindInActivePoC"/>, then starts the underlying scheduler.
/// </summary>
/// <!-- aidoc:v1 sig=518646b body=ec531a6 -->
[OneTimeSetUp]
public async Task SetUp()
{
@@ -267,6 +284,10 @@ public class SchedulerServiceTest
//[TearDown]
/// <summary>
/// Stops the Quartz.NET scheduler engine after all tests in the fixture have run. Uses the null-conditional operator so the call is safely skipped when the scheduler was never initialized.
/// </summary>
/// <!-- aidoc:v1 sig=3273a4f body=5bdc9c3 -->
[OneTimeTearDown]
public void TearDown()
{
@@ -7,6 +7,10 @@ using Moq;
namespace adas_core.Test.Services;
/// <summary>
/// Provides a test fixture for unit testing the SendAlertService class.
/// </summary>
/// <!-- aidoc:v1 sig=405aa53 -->
[TestFixture]
public class SendAlertServiceTest
{
@@ -7,6 +7,10 @@ using ServiceConfigService = adas_core.Application.Services.ServiceConfigService
namespace adas_core.Test.Services;
/// <summary>
/// Test fixture for the ServiceConfigService, containing its related unit tests.
/// </summary>
/// <!-- aidoc:v1 sig=6171c91 -->
[TestFixture]
public class ServiceConfigServiceTest
{
@@ -13,6 +13,10 @@ using static NUnit.Framework.Assert;
namespace adas_core.Test.Services;
/// <summary>
/// Acts as the NUnit test fixture for the TreatmentService, housing the unit tests that verify its behavior.
/// </summary>
/// <!-- aidoc:v1 sig=ea3a14e -->
[TestFixture]
public class TreatmentServiceTest
{