diff --git a/Directory.Build.props b/Directory.Build.props index 2361e3692..ff5427960 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -13,6 +13,7 @@ $(DefineConstants);FEATURE_FILE_SYSTEM_ACL_EXTENSIONS $(DefineConstants);FEATURE_ASYNC_FILE;FEATURE_ENUMERATION_OPTIONS;FEATURE_ADVANCED_PATH_OPERATIONS;FEATURE_PATH_JOIN_WITH_SPAN $(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);FEATURE_FILE_SYSTEM_INFO_LINK_TARGET diff --git a/src/System.IO.Abstractions.TestingHelpers/MockDirectoryInfo.cs b/src/System.IO.Abstractions.TestingHelpers/MockDirectoryInfo.cs index 1fa30a351..d892ccedf 100644 --- a/src/System.IO.Abstractions.TestingHelpers/MockDirectoryInfo.cs +++ b/src/System.IO.Abstractions.TestingHelpers/MockDirectoryInfo.cs @@ -134,6 +134,14 @@ public override DateTime LastWriteTimeUtc set { GetMockFileDataForWrite().LastWriteTime = value.ToLocalTime(); } } +#if FEATURE_FILE_SYSTEM_INFO_LINK_TARGET + /// + public override string LinkTarget + { + get { return GetMockFileDataForRead().LinkTarget; } + } +#endif + /// public override string Name { diff --git a/src/System.IO.Abstractions.TestingHelpers/MockFileData.cs b/src/System.IO.Abstractions.TestingHelpers/MockFileData.cs index 84f9532dc..7b958892a 100644 --- a/src/System.IO.Abstractions.TestingHelpers/MockFileData.cs +++ b/src/System.IO.Abstractions.TestingHelpers/MockFileData.cs @@ -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 } /// @@ -135,6 +138,13 @@ public string TextContents /// public DateTimeOffset LastWriteTime { get; set; } = new DateTimeOffset(2010, 01, 04, 00, 00, 00, TimeSpan.FromHours(4)); +#if FEATURE_FILE_SYSTEM_INFO_LINK_TARGET + /// + /// Gets or sets the link target of the . + /// + public string LinkTarget { get; set; } +#endif + /// /// Casts a string into . /// diff --git a/src/System.IO.Abstractions.TestingHelpers/MockFileInfo.cs b/src/System.IO.Abstractions.TestingHelpers/MockFileInfo.cs index ad8d4c58e..175bd8a21 100644 --- a/src/System.IO.Abstractions.TestingHelpers/MockFileInfo.cs +++ b/src/System.IO.Abstractions.TestingHelpers/MockFileInfo.cs @@ -167,6 +167,18 @@ public override DateTime LastWriteTimeUtc } } +#if FEATURE_FILE_SYSTEM_INFO_LINK_TARGET + /// + public override string LinkTarget + { + get + { + var mockFileData = GetMockFileDataForRead(); + return mockFileData.LinkTarget; + } + } +#endif + /// public override string Name { diff --git a/src/System.IO.Abstractions.TestingHelpers/System.IO.Abstractions.TestingHelpers.csproj b/src/System.IO.Abstractions.TestingHelpers/System.IO.Abstractions.TestingHelpers.csproj index 1916f3969..6fdc33039 100644 --- a/src/System.IO.Abstractions.TestingHelpers/System.IO.Abstractions.TestingHelpers.csproj +++ b/src/System.IO.Abstractions.TestingHelpers/System.IO.Abstractions.TestingHelpers.csproj @@ -3,7 +3,7 @@ System.IO.Abstractions.TestingHelpers System.IO.Abstractions.TestingHelpers A set of pre-built mocks to help when testing file system interactions. - net5.0;netstandard2.1;netstandard2.0;net461 + net6.0;net5.0;netstandard2.1;netstandard2.0;net461 icon_256x256.png @@ -16,6 +16,6 @@ - + diff --git a/src/System.IO.Abstractions/DirectoryInfoWrapper.cs b/src/System.IO.Abstractions/DirectoryInfoWrapper.cs index 427893d58..d7aaccea8 100644 --- a/src/System.IO.Abstractions/DirectoryInfoWrapper.cs +++ b/src/System.IO.Abstractions/DirectoryInfoWrapper.cs @@ -96,6 +96,14 @@ public override DateTime LastWriteTimeUtc set { instance.LastWriteTimeUtc = value; } } +#if FEATURE_FILE_SYSTEM_INFO_LINK_TARGET + /// + public override string LinkTarget + { + get { return instance.LinkTarget; } + } +#endif + /// public override string Name { diff --git a/src/System.IO.Abstractions/FileInfoWrapper.cs b/src/System.IO.Abstractions/FileInfoWrapper.cs index d6ef3c397..ae14d8b69 100644 --- a/src/System.IO.Abstractions/FileInfoWrapper.cs +++ b/src/System.IO.Abstractions/FileInfoWrapper.cs @@ -94,6 +94,14 @@ public override DateTime LastWriteTimeUtc set { instance.LastWriteTimeUtc = value; } } +#if FEATURE_FILE_SYSTEM_INFO_LINK_TARGET + /// + public override string LinkTarget + { + get { return instance.LinkTarget; } + } +#endif + /// public override string Name { diff --git a/src/System.IO.Abstractions/FileSystemInfoBase.cs b/src/System.IO.Abstractions/FileSystemInfoBase.cs index 38b85c21e..c5e4689f5 100644 --- a/src/System.IO.Abstractions/FileSystemInfoBase.cs +++ b/src/System.IO.Abstractions/FileSystemInfoBase.cs @@ -54,6 +54,11 @@ internal FileSystemInfoBase() { } /// public abstract DateTime LastWriteTimeUtc { get; set; } +#if FEATURE_FILE_SYSTEM_INFO_LINK_TARGET + /// + public abstract string LinkTarget { get; } +#endif + /// public abstract string Name { get; } } diff --git a/src/System.IO.Abstractions/System.IO.Abstractions.csproj b/src/System.IO.Abstractions/System.IO.Abstractions.csproj index 322752823..5a8dc751b 100644 --- a/src/System.IO.Abstractions/System.IO.Abstractions.csproj +++ b/src/System.IO.Abstractions/System.IO.Abstractions.csproj @@ -3,14 +3,14 @@ System.IO.Abstractions System.IO.Abstractions A set of abstractions to help make file system interactions testable. - net5.0;netstandard2.1;netstandard2.0;net461 + net6.0;net5.0;netstandard2.1;netstandard2.0;net461 icon_256x256.png - + - + diff --git a/tests/System.IO.Abstractions.TestingHelpers.Tests/MockDirectoryArgumentPathTests.cs b/tests/System.IO.Abstractions.TestingHelpers.Tests/MockDirectoryArgumentPathTests.cs index e556b709b..d76e2d08f 100644 --- a/tests/System.IO.Abstractions.TestingHelpers.Tests/MockDirectoryArgumentPathTests.cs +++ b/tests/System.IO.Abstractions.TestingHelpers.Tests/MockDirectoryArgumentPathTests.cs @@ -28,7 +28,7 @@ private static IEnumerable> GetFileSystemActionsForArgumentNu yield return ds => ds.EnumerateDirectories(null, "foo", SearchOption.AllDirectories); } - [TestCaseSource("GetFileSystemActionsForArgumentNullException")] + [TestCaseSource(nameof(GetFileSystemActionsForArgumentNullException))] public void Operations_ShouldThrowArgumentNullExceptionIfPathIsNull(Action action) { // Arrange diff --git a/tests/System.IO.Abstractions.Tests/__snapshots__/ApiParityTests.DirectoryInfo_.NET 6.0.snap b/tests/System.IO.Abstractions.Tests/__snapshots__/ApiParityTests.DirectoryInfo_.NET 6.0.snap index 9d289a655..e2f78faa2 100644 --- a/tests/System.IO.Abstractions.Tests/__snapshots__/ApiParityTests.DirectoryInfo_.NET 6.0.snap +++ b/tests/System.IO.Abstractions.Tests/__snapshots__/ApiParityTests.DirectoryInfo_.NET 6.0.snap @@ -9,8 +9,6 @@ "System.IO.Abstractions.IFileSystemInfo ResolveLinkTarget(Boolean)", "System.Object GetLifetimeService()", "System.Object InitializeLifetimeService()", - "System.String LinkTarget", - "System.String get_LinkTarget()", "Void .ctor(System.String)", "Void CreateAsSymbolicLink(System.String)", "Void GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)" diff --git a/tests/System.IO.Abstractions.Tests/__snapshots__/ApiParityTests.FileInfo_.NET 6.0.snap b/tests/System.IO.Abstractions.Tests/__snapshots__/ApiParityTests.FileInfo_.NET 6.0.snap index 148c6ee3d..9574a3afb 100644 --- a/tests/System.IO.Abstractions.Tests/__snapshots__/ApiParityTests.FileInfo_.NET 6.0.snap +++ b/tests/System.IO.Abstractions.Tests/__snapshots__/ApiParityTests.FileInfo_.NET 6.0.snap @@ -9,8 +9,6 @@ "System.IO.Abstractions.IFileSystemInfo ResolveLinkTarget(Boolean)", "System.Object GetLifetimeService()", "System.Object InitializeLifetimeService()", - "System.String LinkTarget", - "System.String get_LinkTarget()", "Void .ctor(System.String)", "Void CreateAsSymbolicLink(System.String)", "Void GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)" diff --git a/version.json b/version.json index 8acbd42f7..4afb091a7 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "16.0", + "version": "16.1", "assemblyVersion": { "precision": "major" }, @@ -12,4 +12,4 @@ "enabled": true } } -} \ No newline at end of file +}