Example #1
0
            public async Task GetLatestPackageMetadataAsync_Always_SendsASingleRequestPerSource()
            {
                // Arrange
                var testProject = SetupProject(TestPackageIdentity, allowedVersions: null);

                // Act
                await _target.GetLatestPackageMetadataAsync(
                    TestPackageIdentity,
                    testProject,
                    includePrerelease : true,
                    cancellationToken : CancellationToken.None);

                // Assert
                Mock.Get(_metadataResource).Verify(
                    x => x.GetMetadataAsync(TestPackageIdentity.Id, true, false, It.IsAny <SourceCacheContext>(), It.IsAny <Common.ILogger>(), It.IsAny <CancellationToken>()),
                    Times.Once);
            }
Example #2
0
        protected async Task <IPackageSearchMetadata> GetLatestPackageFromRemoteSourceAsync(PackageIdentity identity, bool includePrerelease)
        {
            var metadataProvider = new MultiSourcePackageMetadataProvider(
                PrimarySourceRepositories,
                optionalLocalRepository: null,
                optionalGlobalLocalRepositories: null,
                logger: Common.NullLogger.Instance);

            return(await metadataProvider.GetLatestPackageMetadataAsync(identity, Project, includePrerelease, Token));
        }
        protected async Task <IPackageSearchMetadata> GetLatestPackageFromRemoteSourceAsync(
            NuGetProject nugetProject,
            PackageIdentity identity,
            bool includePrerelease)
        {
            var metadataProvider = new MultiSourcePackageMetadataProvider(
                PrimarySourceRepositories,
                optionalLocalRepository: null,
                optionalGlobalLocalRepositories: null,
                projects: new [] { nugetProject },
                isSolution: false,
                logger: NuGet.Common.NullLogger.Instance);

            return(await metadataProvider.GetLatestPackageMetadataAsync(identity, includePrerelease, ConsoleHost.Token));
        }