/// <summary> /// Validates if a <see cref="PackageVersion"/> is available to load. /// </summary> /// <param name="versions">The instances of <see cref="PackageVersion"/> that needs to be validated.</param> /// <exception cref="AggregateException">The <paramref name="versions"/> argument is null.</exception> /// <inheritdoc /> public void ConfirmAvailability(IEnumerable <PackageVersion> versions) { EnsureArg.IsNotNull(versions, nameof(versions)); var nonExistingPackages = versions .Where(_ => _.IsUnknown || !packService.IsPackageVersionDeployed(_)) .Stale(); if (nonExistingPackages.Any()) { var errors = nonExistingPackages .Select(_ => new PackageException(PackageException.NotFound, _)); throw new AggregateException(errors); } }