public async Task GetAdministrationsOfUserAsync_ReturnsCorrectAdministrations() { //Arrange _repoWrapper .Setup(r => r.CityAdministration.GetAllAsync(It.IsAny <Expression <Func <CityAdministration, bool> > >(), It.IsAny <Func <IQueryable <CityAdministration>, IIncludableQueryable <CityAdministration, object> > >())) .ReturnsAsync(new List <CityAdministration> { new CityAdministration() { ID = fakeId } }); _mapper .Setup(m => m.Map <IEnumerable <CityAdministration>, IEnumerable <CityAdministrationDTO> >(It.IsAny <IEnumerable <CityAdministration> >())) .Returns(GetTestCityAdministration()); //Act var result = await _cityParticipantsService.GetAdministrationsOfUserAsync(It.IsAny <string>()); //Assert Assert.NotNull(result); Assert.IsInstanceOf <IEnumerable <CityAdministrationDTO> >(result); }
public async Task <IActionResult> GetUserAdministrations(string UserId) { var userAdmins = await _cityParticipantsService.GetAdministrationsOfUserAsync(UserId); return(Ok(userAdmins)); }