Skip to content

Commit

Permalink
Sync NuGet version with CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
dsplaisted committed Apr 10, 2018
1 parent 782a770 commit e18c743
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<MicrosoftExtensionsDependencyModelVersion>2.1.0-preview2-26306-03</MicrosoftExtensionsDependencyModelVersion>
<NETStandardLibraryNETFrameworkVersion>2.0.1-servicing-26011-01</NETStandardLibraryNETFrameworkVersion>
<NewtonsoftJsonVersion>9.0.1</NewtonsoftJsonVersion>
<NuGetBuildTasksPackVersion>4.7.0-preview1.4982</NuGetBuildTasksPackVersion>
<NuGetBuildTasksPackVersion>4.7.0-preview4.5065</NuGetBuildTasksPackVersion>
<NuGetPackagingVersion>$(NuGetBuildTasksPackVersion)</NuGetPackagingVersion>
<NuGetProjectModelVersion>$(NuGetBuildTasksPackVersion)</NuGetProjectModelVersion>
<PlatformAbstractionsVersion>2.0.0</PlatformAbstractionsVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
using NuGet.Common;
using NuGet.Packaging;
using NuGet.Packaging.Core;
using NuGet.Packaging.Signing;
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;

Expand Down Expand Up @@ -145,7 +148,7 @@ private void ExtractNupkg(string nugetCache, string nupkg)
{
PackageExtractor.InstallFromSourceAsync(
identity,
stream => fileStream.CopyToAsync(stream, 4096, CancellationToken.None),
new MockPackageDownloader(fileStream),
pathResolver,
new PackageExtractionContext(
PackageSaveMode.Defaultv3,
Expand All @@ -156,5 +159,52 @@ private void ExtractNupkg(string nugetCache, string nupkg)
}
}
}

private class MockPackageDownloader : IPackageDownloader
{
Stream _source;

public MockPackageDownloader(Stream source)
{
_source = source;
}

public IAsyncPackageContentReader ContentReader => throw new NotImplementedException();

public IAsyncPackageCoreReader CoreReader => throw new NotImplementedException();

public ISignedPackageReader SignedPackageReader => throw new NotImplementedException();

public string Source => throw new NotImplementedException();

public async Task<bool> CopyNupkgFileToAsync(string destinationFilePath, CancellationToken cancellationToken)
{
using (var stream = File.OpenWrite(destinationFilePath))
{
await _source.CopyToAsync(stream, 4096, cancellationToken);
}
return true;
}

public void Dispose()
{
throw new NotImplementedException();
}

public Task<string> GetPackageHashAsync(string hashAlgorithm, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}

public void SetExceptionHandler(Func<Exception, Task<bool>> handleExceptionAsync)
{
throw new NotImplementedException();
}

public void SetThrottle(SemaphoreSlim throttle)
{
throw new NotImplementedException();
}
}
}
}

0 comments on commit e18c743

Please sign in to comment.