Exemplo n.º 1
0
        public static async Task UnsupportedCompression()
        {
            //lzma compression method
            await UnsupportedCompressionRoutine(ZipTest.bad("lzma.zip"), true);

            await UnsupportedCompressionRoutine(ZipTest.bad("invalidDeflate.zip"), false);
        }
Exemplo n.º 2
0
        public static async Task InvalidDates()
        {
            using (ZipArchive archive = new ZipArchive(await StreamHelpers.CreateTempCopyStream(
                                                           ZipTest.bad("invaliddate.zip")), ZipArchiveMode.Read))
            {
                Assert.Equal(new DateTime(1980, 1, 1, 0, 0, 0), archive.Entries[0].LastWriteTime.DateTime); //"Date isn't correct on invalid date"
            }

            using (ZipArchive archive = new ZipArchive(new MemoryStream(), ZipArchiveMode.Create))
            {
                ZipArchiveEntry entry = archive.CreateEntry("test");
                Assert.Throws <ArgumentOutOfRangeException>(() =>
                                                            { entry.LastWriteTime = new DateTimeOffset(1979, 12, 3, 5, 6, 2, new TimeSpan()); }); //"should throw on bad date"
                Assert.Throws <ArgumentOutOfRangeException>(() =>
                                                            { entry.LastWriteTime = new DateTimeOffset(2980, 12, 3, 5, 6, 2, new TimeSpan()); }); //"Should throw on bad date"
            }
        }