rama creada apartir de master en j
This commit is contained in:
@@ -16,6 +16,9 @@ namespace adas_core.Test.Services;
|
||||
[TestFixture]
|
||||
public class TreatmentServiceTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes the mock dependencies and creates a <see cref="TreatmentService"/> instance for unit testing.
|
||||
/// </summary>
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
@@ -172,6 +175,10 @@ public class TreatmentServiceTest
|
||||
}
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that saving an <see cref="ApiRequest"/> without the Case option throws an <see cref="ApiRequestException"/>, preventing the insert operation.
|
||||
/// </summary>
|
||||
/// <exception cref="ApiRequestException">Thrown by the service when the Case option is not provided in the request.</exception>
|
||||
[Test]
|
||||
public void SaveRequest_Not_Case_option_Return_not_insert()
|
||||
{
|
||||
@@ -181,6 +188,9 @@ public class TreatmentServiceTest
|
||||
Assert.ThrowsAsync<ApiRequestException>(act);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that _treatmentService.SaveRequest throws an <see cref="ApiRequestException"/> when the <see cref="ApiRequest"/> is missing both the patient number and the point of care, preventing insertion of an incomplete request.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void SaveRequest_patientNumber_and_pointOfCare_null_Return_not_insert()
|
||||
{
|
||||
@@ -194,6 +204,9 @@ public class TreatmentServiceTest
|
||||
Assert.ThrowsAsync<ApiRequestException>(act);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that _treatmentService.SaveRequest does not insert a patient treatment record when the patient cannot be found in the archive.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public async Task SaveRequest_Not_Find_Patient_Return_not_insert()
|
||||
{
|
||||
@@ -219,6 +232,9 @@ public class TreatmentServiceTest
|
||||
_treatmentArchiveRepositoryMock.Verify(d => d.InsertOneAsync(It.IsAny<PatientTreatment>()), Times.Never);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that SaveRequest does not insert a new patient treatment into the treatment archive when an existing patient is found by patient number.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public async Task SaveRequest_Find_Patient_Return_insert()
|
||||
{
|
||||
@@ -255,6 +271,9 @@ public class TreatmentServiceTest
|
||||
_treatmentArchiveRepositoryMock.Verify(d => d.InsertOneAsync(It.IsAny<PatientTreatment>()), Times.Never);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that <c>GetActiveTreatmentsByPatient</c> retrieves the full set of active treatments for the specified patient, returning a non-empty collection that includes all expected treatment records identified by their placer order entity identifiers.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public async Task GetActiveTreatmentsByPatient()
|
||||
{
|
||||
@@ -272,6 +291,7 @@ public class TreatmentServiceTest
|
||||
That(result.Find(t => t?.PlacerOrder?.EntityIdentifier == "2100"), Is.Not.Null);
|
||||
That(result.Find(t => t?.PlacerOrder?.EntityIdentifier == "4590"), Is.Not.Null);
|
||||
That(result.Find(t => t?.PlacerOrder?.EntityIdentifier == "3690"), Is.Not.Null);
|
||||
};
|
||||
}
|
||||
;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user