public async Task <ActionResult <IEnumerable <Medication> > > GetAllMedicationsAsync( [FromQuery] MedicationSearchFilter filter) { try { var result = await this.merdicationService.GetAllMedicationsAsync(filter); return(this.Ok(result)); } catch (Exception) { return(this.StatusCode(StatusCodes.Status500InternalServerError)); } }
public async Task GetAllMedicationsAsync_Success( MedicationSearchFilter filter, IEnumerable <Medication> medications) { // Arrange this.medicationRepositoryMock .Setup(s => s.GetAllMedicationsAsync(filter.Id, filter.Name)) .ReturnsAsync(medications); // Act var result = await this.medicationService.GetAllMedicationsAsync(filter); // Assert Assert.NotNull(result); Assert.Equal(medications.Count(), result.Count()); }