Skip to content

Commit

Permalink
Use HasFlag instead of bitwise flag comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
vbreuss committed Aug 26, 2022
1 parent 1b567e8 commit 99ebdab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/System.IO.Abstractions.TestingHelpers/MockFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,17 @@ private string GetPathWithCorrectDirectoryCapitalization(string fullPath)
public MockFileData AdjustTimes(MockFileData fileData, TimeAdjustments timeAdjustments)
{
var now = dateTimeProvider();
if ((timeAdjustments & TimeAdjustments.CreationTime) != TimeAdjustments.None)
if (timeAdjustments.HasFlag(TimeAdjustments.CreationTime))
{
fileData.CreationTime = now;
}

if ((timeAdjustments & TimeAdjustments.LastAccessTime) != TimeAdjustments.None)
if (timeAdjustments.HasFlag(TimeAdjustments.LastAccessTime))
{
fileData.LastAccessTime = now;
}

if ((timeAdjustments & TimeAdjustments.LastWriteTime) != TimeAdjustments.None)
if (timeAdjustments.HasFlag(TimeAdjustments.LastWriteTime))
{
fileData.LastWriteTime = now;
}
Expand Down

0 comments on commit 99ebdab

Please sign in to comment.