Class DischargeServiceTest
Provides unit tests for the DischargeService class, verifying the behavior and correctness of discharge-related operations.
public class DischargeServiceTest
- Inheritance
-
DischargeServiceTest
- Inherited Members
- Extension Methods
Methods
DeleteDischargeAsync_WhenDischargeExists_DeletesDischarge()
Verifies that DeleteDischargeAsync(Discharge) successfully deletes a discharge when it exists in the repository.
[Test]
public Task DeleteDischargeAsync_WhenDischargeExists_DeletesDischarge()
Returns
GetDischargeByIdAsync_WhenExceptionOccurs_ReturnsNullAndLogsError()
Verifies that GetDischargeByIdAsync(ObjectId) throws a NotFoundException when the requested discharge is not found.
[Test]
public void GetDischargeByIdAsync_WhenExceptionOccurs_ReturnsNullAndLogsError()
GetDischargeByLocation_WhenDischargeExists_ReturnsDischarge()
Verifies that GetDischargeByLocation(PatientLocation) returns the discharge retrieved from the repository when a discharge exists for the specified patient location.
[Test]
public Task GetDischargeByLocation_WhenDischargeExists_ReturnsDischarge()
Returns
GetDischargeByLocation_WhenExceptionOccurs_ReturnsNullAndLogsError()
Verifies that GetDischargeByLocation(PatientLocation) returns null when the underlying discharge repository throws an exception while retrieving the discharge record for the specified patient location.
[Test]
public Task GetDischargeByLocation_WhenExceptionOccurs_ReturnsNullAndLogsError()
Returns
GetDischargeByPointOfCareId_WhenExceptionOccurs_ReturnsNullAndLogsError()
Verifies that GetDischargeByPointOfCareId(ObjectId) returns null when the underlying repository throws an exception while attempting to retrieve a discharge by its point-of-care identifier.
[Test]
public Task GetDischargeByPointOfCareId_WhenExceptionOccurs_ReturnsNullAndLogsError()
Returns
GetDischargesAsync_WhenNoException_ReturnsDischarges()
Verifies that the discharge service returns the expected discharges retrieved from the repository when the underlying repository call completes successfully without exceptions.
[Test]
public Task GetDischargesAsync_WhenNoException_ReturnsDischarges()
Returns
InsertDischarge_WhenInsertionFails_ReturnsNullAndLogsError()
Verifies that InsertDischarge(Discharge) handles repository insertion failures by propagating the exception thrown by the underlying data store.
[Test]
public void InsertDischarge_WhenInsertionFails_ReturnsNullAndLogsError()
InsertDischarge_WhenInsertionSuccessful_ReturnsInsertedDischarge()
Verifies that InsertDischarge(Discharge) returns the inserted discharge when the underlying repository successfully completes the insertion and the entity can be retrieved by its identifier.
[Test]
public Task InsertDischarge_WhenInsertionSuccessful_ReturnsInsertedDischarge()
Returns
Setup()
Sets up the test environment by creating a mock authenticated user context and instantiating the DischargeService with its required dependencies for use in unit tests.
[SetUp]
public void Setup()