I have this part of code:
int[] toRemoveInChildHotelOffersMealsIds = _hotelOfferDetailsRepository.Get()
.Where(x => toRemoveHotelOfferMealsIds.Contains(x.ParentId.Value))
.Select(x => x.ID)
.ToArray();
This code must return child ids to remove if exist.
And this section throws an error
Nullable object must have a value
in unit tests. And second thing I don't understand why I don't get the same exception during real work.
So how can I modify my code to avoid this exception and search only in records that have a value?