public async Task GetAllTest() { _repoWrapper.Setup(r => r.Religion.GetAllAsync(null, null)).ReturnsAsync(new List <Religion>().AsQueryable()); var service = new ReligionService(_repoWrapper.Object, _mapper.Object); _mapper.Setup(x => x.Map <Religion, ReligionDTO>(It.IsAny <Religion>())).Returns(new ReligionDTO()); // Act var result = await service.GetAllAsync(); // Assert Assert.NotNull(result); Assert.IsAssignableFrom <IEnumerable <ReligionDTO> >(result); }
public static IEnumerable <SelectListItem> FillddlReligion() { var service = new ReligionService(); var religions = service.GetAll(); var listitems = religions.Select(x => new SelectListItem { Text = x.ReligionName, Value = x.Id.ToString() }); return(listitems); }
public async Task TestGetAllNoResults() { // Arrange var religions = new List <Religion>(); var mockUnitOfWork = new Mock <IUnitOfWork>(); mockUnitOfWork .Setup(x => x.ReligionRepository.GetAllAsync(It.IsAny <bool>())) .ReturnsAsync(religions); var service = new ReligionService(mockUnitOfWork.Object, _mapper); // Act var result = await service.GetAllAsync(); // Assert Assert.NotNull(result); Assert.Empty(result); Assert.IsAssignableFrom <IEnumerable <ReligionDTO> >(result); }
public ReligionsController() { Service = new ReligionService(); }
public static IEnumerable<SelectListItem> FillddlReligion() { var service = new ReligionService(); var religions = service.GetAll(); var listitems = religions.Select(x => new SelectListItem { Text = x.ReligionName, Value = x.Id.ToString() }); return listitems; }
public ReligionsController(ReligionService religionService) { _religionService = religionService; }
public ReligionsController() { Service = new ReligionService(); }