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