public async Task TestGetStockItemsAsync() { //Arrange //Act var result = await _patientController.GetAllAsync() as ObjectResult; var value = result.Value as Patient; Assert.IsType <OkObjectResult>(value); }
public async Task GetAllAsync_ShouldReturnListPatient() { // Arrange var patientDto = new PatientDto { Id = 99 }; _mediator.Send(Arg.Any <GetAllPatient.Query>()) .Returns(new GetAllPatient.Response(new List <PatientDto> { patientDto })); // Act var actionResult = await _sut.GetAllAsync(); // Assert if (actionResult.Result is OkObjectResult result) { result.StatusCode.Should().Be(200); if (result.Value is List <PatientDto> value) { value.Should().HaveCount(1); } } }