Ejemplo n.º 1
0
        public PackageSourceMoniker(string sourceName, IEnumerable <PackageSourceContextInfo> packageSources)
        {
            SourceName = sourceName;

            if (packageSources == null)
            {
                throw new ArgumentNullException(nameof(packageSources));
            }
            if (!packageSources.Any())
            {
                throw new ArgumentException("List of sources cannot be empty", nameof(packageSources));
            }

            PackageSources     = packageSources.ToArray();
            PackageSourceNames = PackageSources.Select(s => s.Name).ToList();

            _stringRepresentation = $"{SourceName}: [{string.Join("; ", PackageSourceNames)}]";
            _tooltip = PackageSources.Count() == 1
                ? GetTooltip(PackageSources.First())
                : string.Join("; ", PackageSourceNames);
        }