-
Notifications
You must be signed in to change notification settings - Fork 993
Fix tests and ZipEntry DateTime Kind #502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,20 @@ | |
using NUnit.Framework; | ||
using System; | ||
using System.IO; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace ICSharpCode.SharpZipLib.Tests.Zip | ||
{ | ||
[TestFixture] | ||
public class WindowsNameTransformHandling : TransformBase | ||
{ | ||
[OneTimeSetUp] | ||
public void TestInit() { | ||
if (Path.DirectorySeparatorChar != '\\') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it worth using the [Platform] attribute so that the tests only run on Windows? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe, I didn't actually know about that one. I just figured feature detection was actually what was important anyway, instead of guessing based on the OS. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know what's best, just wondered if tests that involve drive letters might have issues as well as things with separators. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah maybe, it's kind of hard to test until any OS starts using drive letters and forward slashes though 😁 |
||
Assert.Inconclusive("WindowsNameTransform will not work on platforms not using '\\' directory separators"); | ||
} | ||
} | ||
|
||
[Test] | ||
public void BasicFiles() | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any mention of timezones in the appnote, so if it's unknown then unspecified seems a reasonable choice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And more importantly, if you create a DateTime instance and specify that it is in UTC, then the OS will translate it to local time when using it to set the file attributes. If you use
Unspecified
it will not do any such translation.(If the appnote DID mention it being in UTC, we could of course use the UTC-versions of the attribute setters instead).