# Class DiagnosisRepositoryTest

Namespace
  adas_core.Test.Repositories

Assembly
  adas-core.Test.dll

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

Inheritance
  object
  DiagnosisRepositoryTest

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

### DeleteAsync_Find_id()

Verifies that `DeleteAsync` removes a patient diagnosis record by its identifier: after insertion, the record is retrievable by patient id, and once deleted, the search by patient id returns no results.

    [Test]
    public Task DeleteAsync_Find_id()

#### Returns

Task

### DeleteByPatientId_Find_patientId()

Verifies that `DeleteByPatientId` removes all diagnoses associated with the specified patient by inserting a diagnosis, confirming it can be found, deleting it by patient id, and then asserting that no diagnoses remain for that patient.

    [Test]
    public Task DeleteByPatientId_Find_patientId()

#### Returns

Task

### FindByPatientIdAndCode_Find_Patient_Return_Diagnois()

Verifies that FindByPatientIdAndCode(ObjectId, string?, string?) successfully retrieves a diagnosis for an existing patient using the provided patient identifier, diagnosis code, and diagnosis system.

    [Test]
    public Task FindByPatientIdAndCode_Find_Patient_Return_Diagnois()

#### Returns

Task

  A task that represents the asynchronous test execution.

### FindByPatientIdAndCode_not_Find_Patient_Return_null()

Verifies that FindByPatientIdAndCode(ObjectId, string?, string?) returns `null` when no patient is found for the provided patient identifier, code, and diagnosis system.

    [Test]
    public Task FindByPatientIdAndCode_not_Find_Patient_Return_null()

#### Returns

Task

### FindByPatientIdAsync_Find_Patient_Return_List()

Verifies that FindByPatientIdAsync(ObjectId) returns a non-null, non-empty list when looking up an existing patient by their identifier.

    [Test]
    public Task FindByPatientIdAsync_Find_Patient_Return_List()

#### Returns

Task

### FindByPatientIdAsync_not_Find_Patient_Return_Empty_List()

Verifies that `FindByPatientIdAsync` returns a non-null empty list when no patient matches the provided patient ID.

    [Test]
    public Task FindByPatientIdAsync_not_Find_Patient_Return_Empty_List()

#### Returns

Task

### GetByPatient_Find_Patient_Return_List()

Verifies that the repository returns a non-null and non-empty collection when retrieving records for an existing patient.

    [Test]
    public Task GetByPatient_Find_Patient_Return_List()

#### Returns

Task

### GetByPatient_not_Find_Patient_Return_Empty_List()

Verifies that GetByPatient(ObjectId) returns an empty list when no records are found for the specified patient identifier.

    [Test]
    public Task GetByPatient_not_Find_Patient_Return_Empty_List()

#### Returns

Task

### Init()

One-time test setup that prepares the integration database for patient diagnosis tests by dropping and recreating the diagnoses collection, inserting three sample PatientDiagnosis records (one with predefined test identifiers and two with auto-generated identifiers), and initializing the DiagnosisRepository under test.

    [OneTimeSetUp]
    public Task Init()

#### Returns

Task

### UpdateManyObjectId_With_base_UpdateManyObjectIdAsync()

Tests that `UpdateManyObjectId` correctly updates the `PatientId` field across all matching PatientDiagnosis documents by replacing the original ObjectId with a new one. Verifies that after the update, the document can be retrieved using the new patient identifier.

    [Test]
    public Task UpdateManyObjectId_With_base_UpdateManyObjectIdAsync()

#### Returns

Task