public async Task Verificar_GetEnfermeroOferta() { //ARRANGE var mockMapper = new MapperConfiguration(cfg => { cfg.AddProfile(new MappingProfile()); }); var mapper = mockMapper.CreateMapper(); var repository = new Mock <IEnfermeroOfertaRepository>(); repository.Setup(x => x.GetByEnfermeroByOferta(It.IsAny <int>(), It.IsAny <int>())).ReturnsAsync(enfermeroOferta); var controller = new EnfermeroOfertasController(repository.Object, mapper); //ACT var actionResult = await controller.Get(1, 1); var result = actionResult.Result as OkObjectResult; var dto = result.Value as EnfermeroOfertaDTO; //ASSERT Assert.NotNull(result); Assert.IsType <EnfermeroOfertaDTO>(dto); Assert.Equal(1, dto.EnfermeroId); Assert.Equal(1, dto.OfertaId); }
public async Task Verificar_GetListEnfermeroOfertas() { //ARRANGE var mockMapper = new MapperConfiguration(cfg => { cfg.AddProfile(new MappingProfile()); }); var mapper = mockMapper.CreateMapper(); var repository = new Mock <IEnfermeroOfertaRepository>(); repository.Setup(x => x.GetAllByEnfermeroCorreo("*****@*****.**")).ReturnsAsync(listaEnfermeroOfertas); var controller = new EnfermeroOfertasController(repository.Object, mapper); //ACT var actionResult = await controller.GetByEnfermero("*****@*****.**"); var result = actionResult.Result as OkObjectResult; var arr = result.Value as List <EnfermeroOfertaDTO>; //ASSERT Assert.NotNull(result); Assert.IsType <List <EnfermeroOfertaDTO> >(arr); Assert.Equal(2, arr.Count); }