Class AdmissionServiceTest
Contains unit tests for verifying the behavior of the AdmissionService class.
public class AdmissionServiceTest
- Inheritance
-
AdmissionServiceTest
- Inherited Members
- Extension Methods
Methods
AdmitPatient_WithValidAdmission_CreatesPatientAndDeletesAdmission()
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.
[Test]
public Task AdmitPatient_WithValidAdmission_CreatesPatientAndDeletesAdmission()
Returns
DeleteAdmissionAsync_ValidAdmission_DeletesSuccessfully()
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.
[Test]
public Task DeleteAdmissionAsync_ValidAdmission_DeletesSuccessfully()
Returns
DeleteAdmissionByIdAsync_AdmissionExists_DeletesSuccessfully()
Verifies that DeleteAdmissionByIdAsync successfully deletes an admission when it exists in the repository, by ensuring the repository's Delete method is invoked exactly once for the given admission identifier.
[Test]
public Task DeleteAdmissionByIdAsync_AdmissionExists_DeletesSuccessfully()
Returns
GetAdmissionByIdAsync_AdmissionExists_ReturnsAdmissionWithPatientLocation()
Verifies that GetAdmissionByIdAsync(ObjectId) returns the admission together with its associated patient location (unit, bed, and room) when the admission exists in the repository and the corresponding point of care is successfully resolved.
[Test]
public Task GetAdmissionByIdAsync_AdmissionExists_ReturnsAdmissionWithPatientLocation()
Returns
GetAdmissionByLocation_LocationExists_ReturnsAdmissions()
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.
[Test]
public Task GetAdmissionByLocation_LocationExists_ReturnsAdmissions()
Returns
GetAdmissionByLocation_LocationNotFound_ReturnsNull()
Verifies that GetAdmissionByLocation(PatientLocation) returns an empty result when the requested location does not exist, simulating the not-found scenario by having the repository throw an exception.
[Test]
public Task GetAdmissionByLocation_LocationNotFound_ReturnsNull()
Returns
GetAdmissionByPointOfCareId_POCExists_ReturnsAdmissionsWithLocation()
Verifies that when a Point of Care exists for the given identifier, the admissions returned by
GetAdmissionByPointOfCareId are enriched with patient location details (unit name, bed, and room)
retrieved from the corresponding Point of Care entity.
[Test]
public Task GetAdmissionByPointOfCareId_POCExists_ReturnsAdmissionsWithLocation()
Returns
GetAdmissionByPointOfCareId_POCNotFound_ReturnsNull()
Verifies that GetAdmissionByPointOfCareId(ObjectId) returns an empty result when the underlying repository throws an exception while attempting to find an admission by point of care id.
[Test]
public Task GetAdmissionByPointOfCareId_POCNotFound_ReturnsNull()
Returns
GetAdmissionByUnitIdWithOutPoC_UnitIdExists_ReturnsAdmissions()
Verifies that GetAdmissionByUnitIdWithOutPoC(ObjectId) returns the expected list of admissions when a valid unit identifier is provided.
[Test]
public Task GetAdmissionByUnitIdWithOutPoC_UnitIdExists_ReturnsAdmissions()
Returns
GetAdmissionByUnitIdWithOutPoC_UnitIdNotFound_ReturnsNull()
Verifies that GetAdmissionByUnitIdWithOutPoC returns an empty result when the underlying repository
throws an exception while looking up the given unit identifier.
[Test]
public Task GetAdmissionByUnitIdWithOutPoC_UnitIdNotFound_ReturnsNull()
Returns
GetAdmissionsAsync_ReturnsAdmissionsWithPatientLocations()
Verifies that GetAdmissionsAsync returns admissions enriched with their associated patient location details retrieved from the point of care service.
[Test]
public Task GetAdmissionsAsync_ReturnsAdmissionsWithPatientLocations()
Returns
InsertAdmission_ValidAdmission_InsertsSuccessfullyWithUser()
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.
[Test]
public Task InsertAdmission_ValidAdmission_InsertsSuccessfullyWithUser()
Returns
Setup()
[SetUp]
public void Setup()
UpdateAdmissionAsync_WhenAdmissionExists_UpdatesAdmission()
Verifies that adas_core.Test.Services.AdmissionServiceTest._admissionService.UpdateAdmissionAsync correctly updates an existing admission by 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.
[Test]
public Task UpdateAdmissionAsync_WhenAdmissionExists_UpdatesAdmission()