Exemplo n.º 1
0
        public async Task Post_DocotrDTO_ReturnsDocotorDTO(
            [Frozen] Doctor doctor,
            [Frozen] User user,
            [Frozen] ReadDoctorDto readDoctorDto,
            [Frozen] CreateDoctorDto createDoctorDto)
        {
            // Arrange
            doctorServiceMock.Setup(m => m.AddDoctorAsync(doctor, user))
            .ReturnsAsync(doctor);
            mapper.Setup(m => m.Map <Doctor>(createDoctorDto))
            .Returns(doctor);
            mapper.Setup(m => m.Map <User>(createDoctorDto))
            .Returns(user);
            mapper.Setup(m => m.Map <ReadDoctorDto>(doctor))
            .Returns(readDoctorDto);

            // Act
            await doctorController.PostAsync(createDoctorDto);

            // Assert
            doctorServiceMock.Verify(m => m.AddDoctorAsync(doctor, user), Times.Once);
        }