# Class PatientRepositoryTest

Namespace
  adas_core.Test.Repositories

Assembly
  adas-core.Test.dll

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

Inheritance
  object
  PatientRepositoryTest

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

Verifies that a patient can be successfully deleted from the repository by inserting a patient, confirming it exists, deleting it, and then confirming it is no longer retrievable.

    [Test]
    public Task Delete()

#### Returns

Task

### FindAll_Return_List_Patients()

Verifies that the repository's `FindAll` method returns a non-null list containing all expected patient records (five entries).

    [Test]
    public Task FindAll_Return_List_Patients()

#### Returns

Task

### FindById_Find_Return_Patient()

Verifies that FindById returns the expected `Patient` when a valid patient identifier is provided, ensuring the result is not null and the `PatientNumber` matches the expected value.

    [Test]
    public Task FindById_Find_Return_Patient()

#### Returns

Task

### FindByPatientId_Not_Find_Return_Patient()

Verifies that _repository.FindByPatientId returns `null` when no patient is found for the provided patient identifier.

    [Test]
    public Task FindByPatientId_Not_Find_Return_Patient()

#### Returns

Task

### FindByPatientNumber_Find_Return_Patient()

Verifies that the repository's `FindByPatientNumber` method successfully retrieves a patient when called with a valid patient number, returning a non-null result with a matching `PatientNumber`.

    [Test]
    public Task FindByPatientNumber_Find_Return_Patient()

#### Returns

Task

### FindByPatientNumber_Not_Find_Return_Patient()

Verifies that the repository's `FindByPatientNumber` method returns `null` when invoked with an empty patient number, confirming the not-found scenario for blank input.

    [Test]
    public Task FindByPatientNumber_Not_Find_Return_Patient()

#### Returns

Task

### FindByPointOfCare_Find_Return_Patients()

Verifies that the repository returns a non-null and non-empty collection of patients when searching by the identifier of an existing point of care.

    [Test]
    public Task FindByPointOfCare_Find_Return_Patients()

#### Returns

Task

### FindByPointOfCare_Not_Find_Return_Patients()

Verifies that _repository.FindByPointOfCare returns a non-null empty collection when no patients match the provided point of care identifier.

    [Test]
    public Task FindByPointOfCare_Not_Find_Return_Patients()

#### Returns

Task

### FindDischargedPatients_Find_Return_Patients()

Verifies that the repository returns a non-null and non-empty collection of discharged patients when calling `FindDischargedPatients`.

    [Test]
    public Task FindDischargedPatients_Find_Return_Patients()

#### Returns

Task

### FindInActivePoC()

Verifies that _repository.FindInActivePoC returns a non-null result containing exactly three inactive PoC entries.

    [Test]
    public Task FindInActivePoC()

#### Returns

Task

### FindInInactivePoC()

Verifies that _repository.FindInInactivePoC() returns a non-null collection containing exactly two inactive PoC records.

    [Test]
    public Task FindInInactivePoC()

#### Returns

Task

  A Task representing the asynchronous test execution.

### Init()

One-time setup that prepares the integration test database by recreating the `patient`, `pointOfCares`, `units`, and `list_origin` collections and seeding them with five patients, their associated point of care, unit, and origin list records, then verifies that the initial bulk insert yields exactly five patient documents.

    [OneTimeSetUp]
    public Task Init()

#### Returns

Task

### UpdateAttendingDoctor()

Tests that the attending doctor of a point of care entry can be successfully updated with a new doctor. Verifies that after the update, the entry retrieved by point of care reflects the new attending doctor's information.

    [Test]
    public Task UpdateAttendingDoctor()

#### Returns

Task

### Update_with_base_UpdateOneAsync()

Verifies that the repository's `Update` method successfully updates an existing patient record by confirming that the updated `PatientNumber` becomes findable after the update, while ensuring the new value is not present prior to the update operation. Also validates that the updated record is persisted with the modified value and that the patient can be cleaned up via `Delete`.

    [Test]
    public Task Update_with_base_UpdateOneAsync()

#### Returns

Task