Table of Contents

Class DischargeServiceTest

Namespace
adas_core.Test.Services
Assembly
adas-core.Test.dll

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

Task

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

Task

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

Task

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

Task

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

Task

A Task representing the asynchronous test execution.

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

Task

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()