Skip to content

Commit

Permalink
Addressed code review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian McBrayer committed Jan 8, 2022
1 parent 76b93a0 commit 2ffb094
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 7 deletions.
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<DefineConstants Condition="'$(TargetFramework)' != 'net461'">$(DefineConstants);FEATURE_FILE_SYSTEM_ACL_EXTENSIONS</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net5.0' OR '$(TargetFramework)' == 'netcoreapp3.1' OR '$(TargetFramework)' == 'netstandard2.1'">$(DefineConstants);FEATURE_ASYNC_FILE;FEATURE_ENUMERATION_OPTIONS;FEATURE_ADVANCED_PATH_OPERATIONS;FEATURE_PATH_JOIN_WITH_SPAN</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net5.0'">$(DefineConstants);FEATURE_FILE_MOVE_WITH_OVERWRITE;FEATURE_SUPPORTED_OS_ATTRIBUTE;FEATURE_FILE_SYSTEM_WATCHER_FILTERS;FEATURE_ENDS_IN_DIRECTORY_SEPARATOR;FEATURE_PATH_JOIN_WITH_PARAMS;FEATURE_PATH_JOIN_WITH_FOUR_PATHS</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)' == 'net6.0'">$(DefineConstants);FEATURE_FILE_SYSTEM_INFO_LINK_TARGET</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.4.255">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ public override DateTime LastWriteTimeUtc
set { GetMockFileDataForWrite().LastWriteTime = value.ToLocalTime(); }
}

#if NET6_0_OR_GREATER
#if FEATURE_FILE_SYSTEM_INFO_LINK_TARGET
/// <inheritdoc />
public override string LinkTarget
{
get { return null; }
get { return GetMockFileDataForRead().LinkTarget; }
}
#endif

Expand Down
10 changes: 10 additions & 0 deletions src/System.IO.Abstractions.TestingHelpers/MockFileData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ public MockFileData(MockFileData template)
CreationTime = template.CreationTime;
LastAccessTime = template.LastAccessTime;
LastWriteTime = template.LastWriteTime;
#if FEATURE_FILE_SYSTEM_INFO_LINK_TARGET
LinkTarget = template.LinkTarget;
#endif
}

/// <summary>
Expand Down Expand Up @@ -135,6 +138,13 @@ public string TextContents
/// </summary>
public DateTimeOffset LastWriteTime { get; set; } = new DateTimeOffset(2010, 01, 04, 00, 00, 00, TimeSpan.FromHours(4));

#if FEATURE_FILE_SYSTEM_INFO_LINK_TARGET
/// <summary>
/// Gets or sets the link target of the <see cref="MockFileData"/>.
/// </summary>
public string LinkTarget { get; set; } = null;
#endif

/// <summary>
/// Casts a string into <see cref="MockFileData"/>.
/// </summary>
Expand Down
9 changes: 7 additions & 2 deletions src/System.IO.Abstractions.TestingHelpers/MockFileInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,16 @@ public override DateTime LastWriteTimeUtc
}
}

#if NET6_0_OR_GREATER
#if FEATURE_FILE_SYSTEM_INFO_LINK_TARGET
/// <inheritdoc />
public override string LinkTarget
{
get { return null; }
get
{
// TODO Refactor to match #791 style (also hold on merge until that is merged)
if (MockFileData == null) throw CommonExceptions.FileNotFound(path);
return MockFileData.LinkTarget;
}
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/System.IO.Abstractions/DirectoryInfoWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public override DateTime LastWriteTimeUtc
set { instance.LastWriteTimeUtc = value; }
}

#if NET6_0_OR_GREATER
#if FEATURE_FILE_SYSTEM_INFO_LINK_TARGET
/// <inheritdoc />
public override string LinkTarget
{
Expand Down
2 changes: 1 addition & 1 deletion src/System.IO.Abstractions/FileInfoWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public override DateTime LastWriteTimeUtc
set { instance.LastWriteTimeUtc = value; }
}

#if NET6_0_OR_GREATER
#if FEATURE_FILE_SYSTEM_INFO_LINK_TARGET
/// <inheritdoc />
public override string LinkTarget
{
Expand Down
2 changes: 1 addition & 1 deletion src/System.IO.Abstractions/FileSystemInfoBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ internal FileSystemInfoBase() { }
/// <inheritdoc cref="FileSystemInfo.LastWriteTimeUtc"/>
public abstract DateTime LastWriteTimeUtc { get; set; }

#if NET6_0_OR_GREATER
#if FEATURE_FILE_SYSTEM_INFO_LINK_TARGET
/// <inheritdoc cref="FileSystemInfo.LinkTarget"/>
public abstract string LinkTarget { get; }
#endif
Expand Down

0 comments on commit 2ffb094

Please sign in to comment.