# Class AdmissionRepositoryTest

Namespace
  adas_core.Test.Repositories

Assembly
  adas-core.Test.dll

    [TestFixture]
    [Category("Integration")]
    public class AdmissionRepositoryTest

Inheritance
  object
  AdmissionRepositoryTest

Inherited Members
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

Extension Methods
  NumberUtils.IsNumber(object)
  NumberUtils.ToDouble(object)
  ObjectUtils.ToStr(object?)

## Methods

### Delete_Success()

Verifies that the repository successfully deletes an admission record, ensuring that the deleted admission can no longer be retrieved by its identifier.

    [Test]
    public Task Delete_Success()

#### Returns

Task

### FindAll_Success()

Verifies that the repository's FindAll operation successfully retrieves all admissions, returning a non-empty collection of exactly three records.

    [Test]
    public Task FindAll_Success()

#### Returns

Task

### FindByDiagnosis_NoMatch()

Verifies that AdmissionRepository.`FindByDiagnosis` returns an empty collection when no entity matches the provided diagnosis.

    [Test]
    public Task FindByDiagnosis_NoMatch()

#### Returns

Task

### FindByDiagnosis_Success()

Verifies that AdmissionRepository.`FindByDiagnosis` successfully returns a non-null result when retrieving admissions matching the specified diagnosis value.

    [Test]
    public Task FindByDiagnosis_Success()

#### Returns

Task

### FindById_NotFound()

Verifies that the repository's `FindById` method returns `null` when queried with a non-existing identifier.

    [Test]
    public Task FindById_NotFound()

#### Returns

Task

### FindById_Success()

Verifies that the repository successfully retrieves an admission by its unique identifier after it has been inserted.

    [Test]
    public Task FindById_Success()

#### Returns

Task

### FindByNhc_NotFound()

Verifies that AdmissionRepository.`FindByNhc` returns `null` when the provided NHC does not exist in the data source.

    [Test]
    public Task FindByNhc_NotFound()

#### Returns

Task

### FindByNhc_Success()

Verifies that FindByNhc(string) successfully retrieves an admission record from the repository using its NHC identifier. Confirms that the returned record is not null and that the NHC of the retrieved admission matches the one used in the lookup.

    [Test]
    public Task FindByNhc_Success()

#### Returns

Task

### FindByPointOfCareId_NoMatch()

Verifies that AdmissionRepository.FindByPointOfCareId returns a non-null empty collection when no point of care matches the provided identifier.

    [Test]
    public Task FindByPointOfCareId_NoMatch()

#### Returns

Task

### FindByPointOfCareId_Success()

Verifies that the repository's `FindByPointOfCareId` method successfully retrieves the admission matching the specified point of care identifier, returning a single result and excluding admissions associated with different point of care identifiers.

    [Test]
    public Task FindByPointOfCareId_Success()

#### Returns

Task

### GetAdmissionByUnitIdWithOutPoC_NoMatch()

Verifies that `GetAdmissionByUnitIdWithOutPoC` returns an empty result set (instead of null) when no admissions match the provided unit identifier.

    [Test]
    public Task GetAdmissionByUnitIdWithOutPoC_NoMatch()

#### Returns

Task

### GetAdmissionByUnitIdWithOutPoC_Success()

Tests that the repository's `GetAdmissionByUnitIdWithOutPoC` method returns only the admissions matching the specified unit identifier while excluding admissions that have an associated point-of-care identifier.

    [Test]
    public Task GetAdmissionByUnitIdWithOutPoC_Success()

#### Returns

Task

### Init()

Initializes the integration test environment by resetting the admissions collection and seeding it with valid admission records to be used across the test fixture.

    [OneTimeSetUp]
    public Task Init()

#### Returns

Task

### InsertOneAsyncAndReturn_Success()

Verifies that inserting a valid admission through the repository returns the same admission and persists it so it can be retrieved by its identifier.

    [Test]
    public Task InsertOneAsyncAndReturn_Success()

#### Returns

Task

### InsertOneAsync_Success()

Verifies that InsertOneAsync(Admission) successfully persists a valid admission so that it can subsequently be retrieved by its identifier.

    [Test]
    public Task InsertOneAsync_Success()

#### Returns

Task

### UpdateLocation_Success()

Verifies that UpdateLocation(ObjectId, ObjectId) successfully updates the `PointOfCareId` of an existing admission to the specified new location identifier and that the change is persisted in the repository.

    [Test]
    public Task UpdateLocation_Success()

#### Returns

Task

### UpdatePatient_Success()

Verifies that the repository successfully updates the patient information of an existing admission, ensuring the updated admission can be retrieved and reflects the new patient's details.

    [Test]
    public Task UpdatePatient_Success()

#### Returns

Task

### Update_Success()

Verifies that Admission updates are persisted successfully by inserting an admission, modifying one of its fields, and asserting that the updated value is retrieved.

    [Test]
    public Task Update_Success()

#### Returns

Task