public async Task Add_Doctor_ReturnAdedDoctor(Doctor doctor, User user, [Frozen] Mock <IUserService> _userServiceMock, [Frozen] Mock <IRepositoryWrapper> _repositoryMock, [Frozen] Mock <RoleManager <IdentityRole> > _roleManagerMock, [Frozen] IdentityRole role) { // Arrange _repositoryMock.Setup(x => x.DoctorRepository .Add(doctor)); _userServiceMock.Setup(x => x.CreateUserAsync(user, role)) .ReturnsAsync((true, doctor.UserId)); _repositoryMock.Setup(d => d.DoctorRepository.GetFirstOrDefaultAsync(d => d.Id == doctor.Id, It.IsAny <Func <IQueryable <Doctor>, IIncludableQueryable <Doctor, object> > >(), false)) .ReturnsAsync(doctor); var _doctorService = new DoctorService(_repositoryMock.Object, _userServiceMock.Object, _roleManagerMock.Object); // Act var actual = await _doctorService.AddDoctorAsync(doctor, user); // Assert Assert.Equal(doctor, actual); }