Example #1
0
 public async Task AppointmentHandler_Get_GetAllByIdAsync()
 {
     //Arrange
     var getId = 0;
     Appointment result = new Appointment();
     GetAppointmentByIdDto resultDto = new GetAppointmentByIdDto();
     var command = new GetAppointmentByIdQuery(getId);
     var mockAppointmentRepository = new Mock<AppointmentRepository>(null);
     //Act
     mockAppointmentRepository.Setup(x => x.GetByIdAsync(getId, It.IsAny<CancellationToken>())).ReturnsAsync(result);
     var sut = new GetAppointmentByIdQueryHandler(mockAppointmentRepository.Object, null);
     resultDto = await sut.Handle(command, CancellationToken.None);
     //Act
     Assert.NotNull(result);
     Assert.Equal(resultDto.Appointment.Id, getId);
     mockAppointmentRepository.Verify(x => x.GetByIdAsync(getId, It.IsAny<CancellationToken>()), Times.Once);
     mockAppointmentRepository.VerifyNoOtherCalls();
 }
 public GetAppointmentByIdQueryHandlerTests()
 {
     QueryArrangeHelper.AddAppointmentes(context);
     sut = new GetAppointmentByIdQueryHandler(context);
 }