diff --git a/.editorconfig b/.editorconfig index 64fe33b..98b0e96 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,3 +9,7 @@ end_of_line = CRLF [*.cs] indent_style = space indent_size = 4 + +dotnet_diagnostic.NUnit2003.severity = suggestion +dotnet_diagnostic.NUnit2004.severity = suggestion +dotnet_diagnostic.NUnit2005.severity = suggestion \ No newline at end of file diff --git a/.gitignore b/.gitignore index fcdb8a0..4cef864 100644 --- a/.gitignore +++ b/.gitignore @@ -577,3 +577,4 @@ FodyWeavers.xsd # Additional files built by Visual Studio # End of https://www.toptal.com/developers/gitignore/api/csharp,visualstudio,visualstudiocode +*.sh diff --git a/Directory.Build.props b/Directory.Build.props index 09534f7..a7ea18d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -9,20 +9,20 @@ true snupkg true - 9.0 testing https://github.com/System-IO-Abstractions/System.IO.Abstractions.Extensions https://github.com/System-IO-Abstractions/System.IO.Abstractions.Extensions.git git $(MSBuildThisFileDirectory) MIT + README.md - + runtime; build; native; contentfiles; analyzers all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/System.IO.Abstractions.Extensions/IFileInfoAsyncExtensions.cs b/src/System.IO.Abstractions.Extensions/IFileInfoAsyncExtensions.cs index d76b9b2..25e55b4 100644 --- a/src/System.IO.Abstractions.Extensions/IFileInfoAsyncExtensions.cs +++ b/src/System.IO.Abstractions.Extensions/IFileInfoAsyncExtensions.cs @@ -1,4 +1,4 @@ -#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER +#if NET8_0_OR_GREATER #nullable enable using System.Collections.Generic; @@ -85,12 +85,12 @@ public static async IAsyncEnumerable EnumerateLinesAsync(this IFileInfo ? new StreamReader(stream) : new StreamReader(stream, encoding); - var line = await reader.ReadLineAsync(); + var line = await reader.ReadLineAsync(cancellationToken); while (line != null) { yield return line; cancellationToken.ThrowIfCancellationRequested(); - line = await reader.ReadLineAsync(); + line = await reader.ReadLineAsync(cancellationToken); } } } diff --git a/src/System.IO.Abstractions.Extensions/System.IO.Abstractions.Extensions.csproj b/src/System.IO.Abstractions.Extensions/System.IO.Abstractions.Extensions.csproj index f9abea8..4f6809d 100644 --- a/src/System.IO.Abstractions.Extensions/System.IO.Abstractions.Extensions.csproj +++ b/src/System.IO.Abstractions.Extensions/System.IO.Abstractions.Extensions.csproj @@ -2,15 +2,21 @@ TestableIO.System.IO.Abstractions.Extensions - net8.0;net6.0;netstandard2.1;netstandard2.0;net462 + net8.0;netstandard2.1;netstandard2.0;net472 Convenience functionalities on top of System.IO.Abstractions System.IO.Abstractions $([System.IO.File]::ReadAllText("$(MSBuildProjectDirectory)/../../ReleaseNotes.md")) + 9.0 + README.md + + + + - + diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 9d1dbfd..656a2d4 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -9,13 +9,4 @@ --> true - - - - - - - - - \ No newline at end of file diff --git a/tests/System.IO.Abstractions.Extensions.Tests/DirectoryInfoExtensionsTests.cs b/tests/System.IO.Abstractions.Extensions.Tests/DirectoryInfoExtensionsTests.cs index e2fba74..44ed708 100644 --- a/tests/System.IO.Abstractions.Extensions.Tests/DirectoryInfoExtensionsTests.cs +++ b/tests/System.IO.Abstractions.Extensions.Tests/DirectoryInfoExtensionsTests.cs @@ -1,5 +1,6 @@ using NUnit.Framework; using System.Collections.Generic; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace System.IO.Abstractions.Extensions.Tests { diff --git a/tests/System.IO.Abstractions.Extensions.Tests/DisposableDirectoryTests.cs b/tests/System.IO.Abstractions.Extensions.Tests/DisposableDirectoryTests.cs index 5c407ec..1e1cacc 100644 --- a/tests/System.IO.Abstractions.Extensions.Tests/DisposableDirectoryTests.cs +++ b/tests/System.IO.Abstractions.Extensions.Tests/DisposableDirectoryTests.cs @@ -1,4 +1,5 @@ using NUnit.Framework; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace System.IO.Abstractions.Extensions.Tests { @@ -8,7 +9,7 @@ public class DisposableDirectoryTests [Test] public void DisposableDirectory_Throws_ArgumentNullException_For_Null_IDirectoryInfo_Test() { - Assert.Throws(() => new DisposableDirectory(null!)); + Assert.Throws(() => new DisposableDirectory(null)); } [Test] diff --git a/tests/System.IO.Abstractions.Extensions.Tests/DisposableFileTests.cs b/tests/System.IO.Abstractions.Extensions.Tests/DisposableFileTests.cs index caa13aa..a5d9d10 100644 --- a/tests/System.IO.Abstractions.Extensions.Tests/DisposableFileTests.cs +++ b/tests/System.IO.Abstractions.Extensions.Tests/DisposableFileTests.cs @@ -1,4 +1,5 @@ using NUnit.Framework; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace System.IO.Abstractions.Extensions.Tests { @@ -8,7 +9,7 @@ public class DisposableFileTests [Test] public void DisposableFile_Throws_ArgumentNullException_For_Null_IFileInfo_Test() { - Assert.Throws(() => new DisposableFile(null!)); + Assert.Throws(() => new DisposableFile(null)); } [Test] diff --git a/tests/System.IO.Abstractions.Extensions.Tests/FileInfoExtensionsTests.cs b/tests/System.IO.Abstractions.Extensions.Tests/FileInfoExtensionsTests.cs index 57aacf3..068b8e5 100644 --- a/tests/System.IO.Abstractions.Extensions.Tests/FileInfoExtensionsTests.cs +++ b/tests/System.IO.Abstractions.Extensions.Tests/FileInfoExtensionsTests.cs @@ -1,6 +1,7 @@ using NUnit.Framework; using System.Linq; using System.Text; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace System.IO.Abstractions.Extensions.Tests { diff --git a/tests/System.IO.Abstractions.Extensions.Tests/FileSystemExtensionsTests.cs b/tests/System.IO.Abstractions.Extensions.Tests/FileSystemExtensionsTests.cs index 0db52b7..1ec7e1f 100644 --- a/tests/System.IO.Abstractions.Extensions.Tests/FileSystemExtensionsTests.cs +++ b/tests/System.IO.Abstractions.Extensions.Tests/FileSystemExtensionsTests.cs @@ -1,4 +1,5 @@ using NUnit.Framework; +using Assert = NUnit.Framework.Legacy.ClassicAssert; namespace System.IO.Abstractions.Extensions.Tests { @@ -42,7 +43,7 @@ public void CurrentDirectoryTest() var fullName = fs.CurrentDirectory().FullName; Assert.IsFalse(String.IsNullOrWhiteSpace(fullName)); - Assert.AreEqual(Environment.CurrentDirectory, fullName); + NUnit.Framework.Assert.That(fullName, Is.EqualTo(Environment.CurrentDirectory)); } [Test] @@ -119,14 +120,14 @@ public void CreateDisposableFile_Temp_Path_Test() { path = file.FullName; - Assert.IsTrue(file.Exists, "File should exist"); + Assert.That(file.Exists, Is.True, "File should exist"); Assert.IsTrue( path.StartsWith(fs.Path.GetTempPath(), StringComparison.Ordinal), "File should be in temp path"); } // Assert file is deleted - Assert.IsFalse(fs.File.Exists(path), "File should not exist"); + Assert.That(fs.File.Exists(path), Is.False, "File should not exist"); } [Test] diff --git a/tests/System.IO.Abstractions.Extensions.Tests/System.IO.Abstractions.Extensions.Tests.csproj b/tests/System.IO.Abstractions.Extensions.Tests/System.IO.Abstractions.Extensions.Tests.csproj index f3ee503..e2d4a2b 100644 --- a/tests/System.IO.Abstractions.Extensions.Tests/System.IO.Abstractions.Extensions.Tests.csproj +++ b/tests/System.IO.Abstractions.Extensions.Tests/System.IO.Abstractions.Extensions.Tests.csproj @@ -2,14 +2,24 @@ net9.0;net8.0 - $(TargetFrameworks);net462 + $(TargetFrameworks);net472 false true - + - + + + + + + + + + + + diff --git a/version.json b/version.json index d73c740..424502a 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": "2.2", + "version": "22.0", "assemblyVersion": { "precision": "major" },