Example #1
0
#pragma warning disable CS0618 // Type or member is obsolete

        public void SerializeThenDeserialize_WithValidArguments_RoundTrips(PackageSourceUpdateOptions expectedResult)
        {
            PackageSourceUpdateOptions actualResult = SerializeThenDeserialize(PackageSourceUpdateOptionsFormatter.Instance, expectedResult);

            Assert.Equal(expectedResult.UpdateCredentials, actualResult.UpdateCredentials);
            Assert.Equal(expectedResult.UpdateEnabled, actualResult.UpdateEnabled);
        }
Example #2
0
        public async ValueTask SavePackageSourcesAsync(IReadOnlyList <PackageSource> sources, PackageSourceUpdateOptions packageSourceUpdateOptions, CancellationToken cancellationToken)
#pragma warning restore CS0618 // Type or member is obsolete
        {
            var packageSources = await ServiceLocator.GetInstanceAsync <ISourceRepositoryProvider>();

            Assumes.NotNull(packageSources);

#pragma warning disable CS0618 // Type or member is obsolete
            var packageSources2 = packageSources.PackageSourceProvider as IPackageSourceProvider2;
#pragma warning restore CS0618 // Type or member is obsolete
            if (packageSources2 != null)
            {
                packageSources2.SavePackageSources(sources, packageSourceUpdateOptions);
            }
            else
            {
                packageSources.PackageSourceProvider.SavePackageSources(sources);
            }
        }
        public async ValueTask SavePackageSourcesAsync(IReadOnlyList <PackageSource> sources, PackageSourceUpdateOptions packageSourceUpdateOptions, CancellationToken cancellationToken)
        {
            var packageSources = await ServiceLocator.GetInstanceAsync <ISourceRepositoryProvider>();

            Assumes.NotNull(packageSources);

            var packageSources2 = packageSources.PackageSourceProvider as IPackageSourceProvider2;

            if (packageSources2 != null)
            {
                packageSources2.SavePackageSources(sources, packageSourceUpdateOptions);
            }
            else
            {
                packageSources.PackageSourceProvider.SavePackageSources(sources);
            }
        }
 public ValueTask SavePackageSourcesAsync(IReadOnlyList <PackageSource> sources, PackageSourceUpdateOptions packageSourceUpdateOptions, CancellationToken cancellationToken)
 {
     return(Service.SavePackageSourcesAsync(sources, packageSourceUpdateOptions, cancellationToken));
 }
 public ValueTask SavePackageSourcesAsync(IReadOnlyList <PackageSource> sources, PackageSourceUpdateOptions packageSourceUpdateOptions, CancellationToken cancellationToken) => new ValueTask();
        public ValueTask SavePackageSourcesAsync(IReadOnlyList <PackageSource> sources, PackageSourceUpdateOptions packageSourceUpdateOptions, CancellationToken cancellationToken)
        {
            var packageSources2 = _sharedServiceState.SourceRepositoryProvider.PackageSourceProvider as IPackageSourceProvider2;

#pragma warning restore CS0618 // Type or member is obsolete

            if (packageSources2 != null)
            {
                packageSources2.SavePackageSources(sources, packageSourceUpdateOptions);
            }
            else
            {
                _sharedServiceState.SourceRepositoryProvider.PackageSourceProvider.SavePackageSources(sources);
            }

            return(new ValueTask());
        }