public async Task <ActionResult <ApiResponse> > AddRemark([FromBody] AddRemarkRequest remark, [FromServices] IRemarksService remarksService, [FromServices] IUserDetailsProvider userDetailsProvider) { var userDetails = userDetailsProvider.GetUserDetails(); var response = await remarksService.AddRemark(userDetails.Email, remark); return(ApiResponseHelper.Created("Remark created.", response)); }
public async void AddRemark_Should_Call_IRemarksRepository_AddRemark() { var email = "email"; var request = new AddRemarkRequest { Latitude = 123, Longitude = 456, Remark = "remarks" }; RemarkDetails arg = null; await _repository.AddRemark(Arg.Do <RemarkDetails>(a => arg = a)); await _service.AddRemark(email, request); await _repository.Received(1).AddRemark(Arg.Any <RemarkDetails>()); arg.Email.Should().Be(email); arg.Latitude.Should().Be(request.Latitude); arg.Longitude.Should().Be(request.Longitude); arg.Remark.Should().Be(request.Remark); }