public async Task Test_ExtractionHonorsFileTimestamp() { // Arrange var packageIdentity = new PackageIdentity("packageA", new NuGetVersion("2.0.3")); var entryModifiedTime = new DateTimeOffset(1985, 11, 20, 12, 0, 0, TimeSpan.FromHours(-7.0)).DateTime; using (var packagesDirectory = TestDirectory.Create()) { var pathResolver = new VersionFolderPathResolver(packagesDirectory); var packageFileInfo = await TestPackagesCore.GeneratePackageAsync( packagesDirectory, packageIdentity.Id, packageIdentity.Version.ToNormalizedString(), entryModifiedTime, "lib/net45/A.dll"); var packageExtractionContext = new PackageExtractionContext( packageSaveMode: PackageSaveMode.Defaultv3, xmlDocFileSaveMode: XmlDocFileSaveMode.None, logger: NullLogger.Instance, signedPackageVerifier: null, signedPackageVerifierSettings: null); var versionFolderPathResolver = new VersionFolderPathResolver(packagesDirectory); // Act using (var packageDownloader = new LocalPackageArchiveDownloader( null, packageFileInfo.FullName, packageIdentity, NullLogger.Instance)) { await PackageExtractor.InstallFromSourceAsync( packageIdentity, packageDownloader, versionFolderPathResolver, packageExtractionContext, CancellationToken.None); } // Assert var packageVersionDirectory = pathResolver.GetInstallPath(packageIdentity.Id, packageIdentity.Version); AssertDirectoryExists(packageVersionDirectory); var dllPath = Path.Combine(packageVersionDirectory, "lib", "net45", "A.dll"); var dllFileInfo = new FileInfo(dllPath); AssertFileExists(dllFileInfo.FullName); Assert.Equal(entryModifiedTime, dllFileInfo.LastWriteTime); } }