From 7ed87d10b8ecafeb5abb5a129c046837416ac11f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nils=20m=C3=A5s=C3=A9n?= Date: Sun, 14 Mar 2021 18:34:45 +0100 Subject: [PATCH] PR #603: pass CreateZip tests that are within time tolerance --- test/ICSharpCode.SharpZipLib.Tests/Zip/FastZipHandling.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/ICSharpCode.SharpZipLib.Tests/Zip/FastZipHandling.cs b/test/ICSharpCode.SharpZipLib.Tests/Zip/FastZipHandling.cs index 541e57cd..9a6baac7 100644 --- a/test/ICSharpCode.SharpZipLib.Tests/Zip/FastZipHandling.cs +++ b/test/ICSharpCode.SharpZipLib.Tests/Zip/FastZipHandling.cs @@ -725,7 +725,10 @@ public void CreateZipShouldSetTimeOnEntriesFromConstructorTimeSetting(TimeSettin var archive = new MemoryStream(target.ToArray()); using (var zf = new ZipFile(archive)) { - Assert.AreEqual(TestTargetTime(timeSetting), zf[0].DateTime); + var expectedTime = TestTargetTime(timeSetting); + var actualTime = zf[0].DateTime; + // Assert that the time is within +/- 2s of the target time to allow for timing/rounding discrepancies + Assert.LessOrEqual(Math.Abs((expectedTime - actualTime).TotalSeconds), 2); } }