public async Task GetById() { var mappingService = new Mock <IMapper>(); //Arrange var usuarioEntity = new UsuarioEntity { Id = 1 }; var usuarioResponseModel = new UsuarioResponseModel { Id = 1 }; _mockCore.Setup(x => x.GetAsync(1)).ReturnsAsync(usuarioEntity); mappingService.Setup(m => m.Map <UsuarioEntity, UsuarioResponseModel>(It.IsAny <UsuarioEntity>())).Returns(usuarioResponseModel); var controller = new UsuarioController(_mockCore.Object, mappingService.Object) { ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext() } }; //Act var apiResponse = await controller.Get(1); //Assert Assert.Equal(apiResponse.Data.Id, usuarioEntity.Id); }
public void AsignarUsuarioResponseModel(UsuarioResponseModel model) { this.TipoDocumento = model.TipoIdentificacion.ValorPrincipal; this.NumeroDocumento = model.NumeroIdentificacion; this.Nombres = model.Nombres; this.Apellidos = model.Apellidos; }