public async Task GetAllAsync_ShouldReturnListPatient() { // Arrange var assessment = new Assessment() { GivenName = "Unit", FamilyName = "Test" }; _mediator.Send(Arg.Any <GetAssessmentByPatientId.Query>()) .Returns(new GetAssessmentByPatientId.Response(assessment)); // Act var actionResult = await _sut.GetByIdAsync(new Random().Next()); // Assert if (actionResult.Result is OkObjectResult result) { result.StatusCode.Should().Be(200); if (result.Value is Assessment value) { value.GivenName.Should().Be("Unit"); value.FamilyName.Should().Be("Test"); } } }