=== 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:
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user