Skip to content

Instantly share code, notes, and snippets.

@WernerMairl
Created November 19, 2018 18:56
Show Gist options
  • Save WernerMairl/a40f6e9779a2068dcce9b3cb6aac18f7 to your computer and use it in GitHub Desktop.
Save WernerMairl/a40f6e9779a2068dcce9b3cb6aac18f7 to your computer and use it in GitHub Desktop.
using System;
using System.IO;
.....
[Fact]
public void CreationTimeUtc_Bug()
{
string proposedFileName = Path.GetTempFileName();
File.Delete(proposedFileName);
File.WriteAllText(proposedFileName, "dummy file content as text");
FileInfo localFile = new System.IO.FileInfo(proposedFileName);
DateTime newCreationTimeUTC = System.DateTime.UtcNow.Subtract(TimeSpan.FromDays(365));
localFile.CreationTimeUtc = newCreationTimeUTC;
Assert.True(localFile.CreationTimeUtc == newCreationTimeUTC, "thats a BUG!!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment