public void ShouldAddRelocationPlaces() { var httpResult = controller.Get(1); var response = httpResult as JsonResult <CandidateDTO>; var candidate = response.Content; int countryId = context.Countries.First().Id; int cityId = context.Cities.First().Id; var newRelocationPlace = new RelocationPlaceDTO { CountryId = countryId, CityId = cityId }; var places = candidate.RelocationPlaces.ToList(); places.Add(newRelocationPlace); candidate.RelocationPlaces = places; var newHttpResult = controller.Put(candidate.Id, candidate); var newResponse = newHttpResult as JsonResult <CandidateDTO>; var newCandidate = newResponse.Content; Assert.IsTrue(newCandidate.RelocationPlaces.Any(x => x.CityId == cityId && x.CountryId == countryId)); }
public void ShouldAddRelocationPlaces() { var httpResult = controller.Get(1); var response = httpResult as JsonResult<CandidateDTO>; var candidate = response.Content; int countryId = context.Countries.First().Id; int cityId = context.Cities.First().Id; var newRelocationPlace = new RelocationPlaceDTO { CountryId = countryId, CityId = cityId }; var places = candidate.RelocationPlaces.ToList(); places.Add(newRelocationPlace); candidate.RelocationPlaces = places; var newHttpResult = controller.Put(candidate.Id, candidate); var newResponse = newHttpResult as JsonResult<CandidateDTO>; var newCandidate = newResponse.Content; Assert.IsTrue(newCandidate.RelocationPlaces.Any(x => x.CityId == cityId && x.CountryId == countryId)); }
public static void Update(this RelocationPlace destination, RelocationPlaceDTO source) { destination.CountryId = source.CountryId; destination.CityId = source.CityId; }
public static void Update(this RelocationPlace destination, RelocationPlaceDTO source) { destination.CountryId = source.CountryId; destination.CityId = source.CityId; }