Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions src/libraries/System.IO.Compression.ZipFile/tests/ZipFile.Create.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,19 +282,23 @@ public void InvalidDates()
Assert.Equal(new DateTime(1980, 1, 1, 0, 0, 0), archive.Entries[0].LastWriteTime.DateTime);
}

FileInfo fileWithBadDate = new FileInfo(GetTestFilePath());
fileWithBadDate.Create().Dispose();
fileWithBadDate.LastWriteTimeUtc = new DateTime(1970, 1, 1, 1, 1, 1);

string archivePath = GetTestFilePath();
using (FileStream output = File.Open(archivePath, FileMode.Create))
using (ZipArchive archive = new ZipArchive(output, ZipArchiveMode.Create))
{
archive.CreateEntryFromFile(fileWithBadDate.FullName, "SomeEntryName");
}
using (ZipArchive archive = ZipFile.OpenRead(archivePath))
// Browser VFS does not support saving file attributes, so skip
if (!PlatformDetection.IsBrowser)
{
Assert.Equal(new DateTime(1980, 1, 1, 0, 0, 0), archive.Entries[0].LastWriteTime.DateTime);
FileInfo fileWithBadDate = new FileInfo(GetTestFilePath());
fileWithBadDate.Create().Dispose();
fileWithBadDate.LastWriteTimeUtc = new DateTime(1970, 1, 1, 1, 1, 1);

string archivePath = GetTestFilePath();
using (FileStream output = File.Open(archivePath, FileMode.Create))
using (ZipArchive archive = new ZipArchive(output, ZipArchiveMode.Create))
{
archive.CreateEntryFromFile(fileWithBadDate.FullName, "SomeEntryName");
}
using (ZipArchive archive = ZipFile.OpenRead(archivePath))
{
Assert.Equal(new DateTime(1980, 1, 1, 0, 0, 0), archive.Entries[0].LastWriteTime.DateTime);
}
}
}

Expand Down
1 change: 0 additions & 1 deletion src/libraries/tests.proj
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Globalization.Calendars\tests\System.Globalization.Calendars.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Globalization.Extensions\tests\System.Globalization.Extensions.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Globalization\tests\System.Globalization.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.IO.Compression.ZipFile\tests\System.IO.Compression.ZipFile.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.IO.Compression\tests\System.IO.Compression.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.IO.FileSystem.DriveInfo\tests\System.IO.FileSystem.DriveInfo.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.IO.FileSystem\tests\System.IO.FileSystem.Tests.csproj" />
Expand Down