Skip to content

Smdn.Test.NUnit.Utils version 4.0.0

Compare
Choose a tag to compare
@smdn smdn released this 14 Dec 15:10
· 305 commits to main since this release
28bf135

Released package

Release notes

The full release notes are available at gist.

Change log

Change log in this release:

API changes

API changes in this release:
diff --git a/doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-net45.apilist.cs b/doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-net462.apilist.cs
similarity index 85%
rename from doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-net45.apilist.cs
rename to doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-net462.apilist.cs
index 1b85c407..3ee04000 100644
--- a/doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-net45.apilist.cs
+++ b/doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-net462.apilist.cs
@@ -1,56 +1,58 @@
-// Smdn.Test.NUnit.Utils.dll (Smdn.Test.NUnit.Utils-1.0.0)
+// Smdn.Test.NUnit.Utils.dll (Smdn.Test.NUnit.Utils-4.0.0)
 //   Name: Smdn.Test.NUnit.Utils
-//   AssemblyVersion: 1.0.0.0
-//   InformationalVersion: 1.0.0+7598ad3f6134b7fcb21ff256682be15e2cd04b61
-//   TargetFramework: .NETFramework,Version=v4.5
+//   AssemblyVersion: 4.0.0.0
+//   InformationalVersion: 4.0.0+280107daf772c089f4bf30b5bce3f2dded855766
+//   TargetFramework: .NETFramework,Version=v4.6.2
 //   Configuration: Release
 //   Referenced assemblies:
 //     System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
 //     System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
 //     mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-//     nunit.framework, Version=3.13.2.0, Culture=neutral, PublicKeyToken=2638cd05610744eb
+//     nunit.framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb
+//     nunit.framework.legacy, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb
 
 using System;
 using System.IO;
 using System.Runtime.Serialization;
 using System.Text;
 using System.Threading.Tasks;
 using NUnit.Framework;
+using NUnit.Framework.Legacy;
 
 namespace Smdn.Test.NUnit {
   public static class Encodings {
     public static Encoding EucJP { get; }
     public static Encoding Jis { get; }
     public static Encoding Latin1 { get; }
     public static Encoding ShiftJis { get; }
   }
 
   public static class IOUtils {
     public static void UsingCurrentDirectory(string path, Action action) {}
     public static async Task UsingCurrentDirectoryAsync(string path, Func<Task> action) {}
     public static void UsingDirectory(string path, Action<DirectoryInfo> action) {}
     public static void UsingDirectory(string path, bool ensureDirectoryCreated, Action<DirectoryInfo> action) {}
     public static Task UsingDirectoryAsync(string path, Func<DirectoryInfo, Task> action) {}
     public static async Task UsingDirectoryAsync(string path, bool ensureDirectoryCreated, Func<DirectoryInfo, Task> action) {}
     public static void UsingFile(string path, Action<FileInfo> action) {}
     public static async Task UsingFileAsync(string path, Func<FileInfo, Task> action) {}
   }
 }
 
 namespace Smdn.Test.NUnit.Assertion {
-  public class Assert : Assert {
+  public class Assert : ClassicAssert {
     public static void Elapses(TimeSpan expected, TestDelegate code, string message = null) {}
     public static void ElapsesAsync(TimeSpan expected, AsyncTestDelegate code, string message = null) {}
     public static void ElapsesInRange(TimeSpan expectedMin, TimeSpan expectedMax, TestDelegate code, string message = null) {}
     public static void ElapsesInRangeAsync(TimeSpan expectedMin, TimeSpan expectedMax, AsyncTestDelegate code, string message = null) {}
     public static void IsSerializable<TSerializable>(TSerializable obj, Action<TSerializable> testDeserializedObject = null) {}
     public static void IsSerializable<TSerializable>(TSerializable obj, IFormatter serializationFormatter, IFormatter deserializationFormatter, Action<TSerializable> testDeserializedObject = null) {}
     public static void NotElapse(TimeSpan expected, TestDelegate code, string message = null) {}
     public static void NotElapseAsync(TimeSpan expected, AsyncTestDelegate code, string message = null) {}
     public static TException ThrowsOrAggregates<TException>(TestDelegate code) where TException : Exception {}
 
     public Assert() {}
   }
 }
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.1.7.0.
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.3.0.0.
 // Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
diff --git a/doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-net472.apilist.cs b/doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-net472.apilist.cs
index 7a492dc7..0f3b5e5e 100644
--- a/doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-net472.apilist.cs
+++ b/doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-net472.apilist.cs
@@ -1,56 +1,58 @@
-// Smdn.Test.NUnit.Utils.dll (Smdn.Test.NUnit.Utils-1.0.0)
+// Smdn.Test.NUnit.Utils.dll (Smdn.Test.NUnit.Utils-4.0.0)
 //   Name: Smdn.Test.NUnit.Utils
-//   AssemblyVersion: 1.0.0.0
-//   InformationalVersion: 1.0.0+7598ad3f6134b7fcb21ff256682be15e2cd04b61
+//   AssemblyVersion: 4.0.0.0
+//   InformationalVersion: 4.0.0+280107daf772c089f4bf30b5bce3f2dded855766
 //   TargetFramework: .NETFramework,Version=v4.7.2
 //   Configuration: Release
 //   Referenced assemblies:
 //     System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
 //     System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
 //     mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-//     nunit.framework, Version=3.13.2.0, Culture=neutral, PublicKeyToken=2638cd05610744eb
+//     nunit.framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb
+//     nunit.framework.legacy, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb
 
 using System;
 using System.IO;
 using System.Runtime.Serialization;
 using System.Text;
 using System.Threading.Tasks;
 using NUnit.Framework;
+using NUnit.Framework.Legacy;
 
 namespace Smdn.Test.NUnit {
   public static class Encodings {
     public static Encoding EucJP { get; }
     public static Encoding Jis { get; }
     public static Encoding Latin1 { get; }
     public static Encoding ShiftJis { get; }
   }
 
   public static class IOUtils {
     public static void UsingCurrentDirectory(string path, Action action) {}
     public static async Task UsingCurrentDirectoryAsync(string path, Func<Task> action) {}
     public static void UsingDirectory(string path, Action<DirectoryInfo> action) {}
     public static void UsingDirectory(string path, bool ensureDirectoryCreated, Action<DirectoryInfo> action) {}
     public static Task UsingDirectoryAsync(string path, Func<DirectoryInfo, Task> action) {}
     public static async Task UsingDirectoryAsync(string path, bool ensureDirectoryCreated, Func<DirectoryInfo, Task> action) {}
     public static void UsingFile(string path, Action<FileInfo> action) {}
     public static async Task UsingFileAsync(string path, Func<FileInfo, Task> action) {}
   }
 }
 
 namespace Smdn.Test.NUnit.Assertion {
-  public class Assert : Assert {
+  public class Assert : ClassicAssert {
     public static void Elapses(TimeSpan expected, TestDelegate code, string message = null) {}
     public static void ElapsesAsync(TimeSpan expected, AsyncTestDelegate code, string message = null) {}
     public static void ElapsesInRange(TimeSpan expectedMin, TimeSpan expectedMax, TestDelegate code, string message = null) {}
     public static void ElapsesInRangeAsync(TimeSpan expectedMin, TimeSpan expectedMax, AsyncTestDelegate code, string message = null) {}
     public static void IsSerializable<TSerializable>(TSerializable obj, Action<TSerializable> testDeserializedObject = null) {}
     public static void IsSerializable<TSerializable>(TSerializable obj, IFormatter serializationFormatter, IFormatter deserializationFormatter, Action<TSerializable> testDeserializedObject = null) {}
     public static void NotElapse(TimeSpan expected, TestDelegate code, string message = null) {}
     public static void NotElapseAsync(TimeSpan expected, AsyncTestDelegate code, string message = null) {}
     public static TException ThrowsOrAggregates<TException>(TestDelegate code) where TException : Exception {}
 
     public Assert() {}
   }
 }
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.1.7.0.
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.3.0.0.
 // Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
diff --git a/doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-net6.0.apilist.cs b/doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-net6.0.apilist.cs
index 5b4770ae..57e04c4d 100644
--- a/doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-net6.0.apilist.cs
+++ b/doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-net6.0.apilist.cs
@@ -1,58 +1,60 @@
-// Smdn.Test.NUnit.Utils.dll (Smdn.Test.NUnit.Utils-1.0.0)
+// Smdn.Test.NUnit.Utils.dll (Smdn.Test.NUnit.Utils-4.0.0)
 //   Name: Smdn.Test.NUnit.Utils
-//   AssemblyVersion: 1.0.0.0
-//   InformationalVersion: 1.0.0+7598ad3f6134b7fcb21ff256682be15e2cd04b61
+//   AssemblyVersion: 4.0.0.0
+//   InformationalVersion: 4.0.0+280107daf772c089f4bf30b5bce3f2dded855766
 //   TargetFramework: .NETCoreApp,Version=v6.0
 //   Configuration: Release
 //   Referenced assemblies:
 //     System.Linq, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 //     System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 //     System.Runtime.Serialization.Formatters, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 //     System.Text.Encoding.CodePages, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 //     System.Threading.Thread, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-//     nunit.framework, Version=3.13.2.0, Culture=neutral, PublicKeyToken=2638cd05610744eb
+//     nunit.framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb
+//     nunit.framework.legacy, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb
 
 using System;
 using System.IO;
 using System.Runtime.Serialization;
 using System.Text;
 using System.Threading.Tasks;
 using NUnit.Framework;
+using NUnit.Framework.Legacy;
 
 namespace Smdn.Test.NUnit {
   public static class Encodings {
     public static Encoding EucJP { get; }
     public static Encoding Jis { get; }
     public static Encoding Latin1 { get; }
     public static Encoding ShiftJis { get; }
   }
 
   public static class IOUtils {
     public static void UsingCurrentDirectory(string path, Action action) {}
     public static async Task UsingCurrentDirectoryAsync(string path, Func<Task> action) {}
     public static void UsingDirectory(string path, Action<DirectoryInfo> action) {}
     public static void UsingDirectory(string path, bool ensureDirectoryCreated, Action<DirectoryInfo> action) {}
     public static Task UsingDirectoryAsync(string path, Func<DirectoryInfo, Task> action) {}
     public static async Task UsingDirectoryAsync(string path, bool ensureDirectoryCreated, Func<DirectoryInfo, Task> action) {}
     public static void UsingFile(string path, Action<FileInfo> action) {}
     public static async Task UsingFileAsync(string path, Func<FileInfo, Task> action) {}
   }
 }
 
 namespace Smdn.Test.NUnit.Assertion {
-  public class Assert : Assert {
+  public class Assert : ClassicAssert {
     public static void Elapses(TimeSpan expected, TestDelegate code, string message = null) {}
     public static void ElapsesAsync(TimeSpan expected, AsyncTestDelegate code, string message = null) {}
     public static void ElapsesInRange(TimeSpan expectedMin, TimeSpan expectedMax, TestDelegate code, string message = null) {}
     public static void ElapsesInRangeAsync(TimeSpan expectedMin, TimeSpan expectedMax, AsyncTestDelegate code, string message = null) {}
     public static void IsSerializable<TSerializable>(TSerializable obj, Action<TSerializable> testDeserializedObject = null) {}
     public static void IsSerializable<TSerializable>(TSerializable obj, IFormatter serializationFormatter, IFormatter deserializationFormatter, Action<TSerializable> testDeserializedObject = null) {}
     public static void NotElapse(TimeSpan expected, TestDelegate code, string message = null) {}
     public static void NotElapseAsync(TimeSpan expected, AsyncTestDelegate code, string message = null) {}
     public static TException ThrowsOrAggregates<TException>(TestDelegate code) where TException : Exception {}
 
     public Assert() {}
   }
 }
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.1.7.0.
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.3.0.0.
 // Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
diff --git a/doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-netstandard2.0.apilist.cs b/doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-netstandard2.0.apilist.cs
deleted file mode 100644
index 58803985..00000000
--- a/doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-netstandard2.0.apilist.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-// Smdn.Test.NUnit.Utils.dll (Smdn.Test.NUnit.Utils-1.0.0)
-//   Name: Smdn.Test.NUnit.Utils
-//   AssemblyVersion: 1.0.0.0
-//   InformationalVersion: 1.0.0+7598ad3f6134b7fcb21ff256682be15e2cd04b61
-//   TargetFramework: .NETStandard,Version=v2.0
-//   Configuration: Release
-//   Referenced assemblies:
-//     System.Text.Encoding.CodePages, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-//     netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
-//     nunit.framework, Version=3.13.2.0, Culture=neutral, PublicKeyToken=2638cd05610744eb
-
-using System;
-using System.IO;
-using System.Runtime.Serialization;
-using System.Text;
-using System.Threading.Tasks;
-using NUnit.Framework;
-
-namespace Smdn.Test.NUnit {
-  public static class Encodings {
-    public static Encoding EucJP { get; }
-    public static Encoding Jis { get; }
-    public static Encoding Latin1 { get; }
-    public static Encoding ShiftJis { get; }
-  }
-
-  public static class IOUtils {
-    public static void UsingCurrentDirectory(string path, Action action) {}
-    public static async Task UsingCurrentDirectoryAsync(string path, Func<Task> action) {}
-    public static void UsingDirectory(string path, Action<DirectoryInfo> action) {}
-    public static void UsingDirectory(string path, bool ensureDirectoryCreated, Action<DirectoryInfo> action) {}
-    public static Task UsingDirectoryAsync(string path, Func<DirectoryInfo, Task> action) {}
-    public static async Task UsingDirectoryAsync(string path, bool ensureDirectoryCreated, Func<DirectoryInfo, Task> action) {}
-    public static void UsingFile(string path, Action<FileInfo> action) {}
-    public static async Task UsingFileAsync(string path, Func<FileInfo, Task> action) {}
-  }
-}
-
-namespace Smdn.Test.NUnit.Assertion {
-  public class Assert : Assert {
-    public static void Elapses(TimeSpan expected, TestDelegate code, string message = null) {}
-    public static void ElapsesAsync(TimeSpan expected, AsyncTestDelegate code, string message = null) {}
-    public static void ElapsesInRange(TimeSpan expectedMin, TimeSpan expectedMax, TestDelegate code, string message = null) {}
-    public static void ElapsesInRangeAsync(TimeSpan expectedMin, TimeSpan expectedMax, AsyncTestDelegate code, string message = null) {}
-    public static void IsSerializable<TSerializable>(TSerializable obj, Action<TSerializable> testDeserializedObject = null) {}
-    public static void IsSerializable<TSerializable>(TSerializable obj, IFormatter serializationFormatter, IFormatter deserializationFormatter, Action<TSerializable> testDeserializedObject = null) {}
-    public static void NotElapse(TimeSpan expected, TestDelegate code, string message = null) {}
-    public static void NotElapseAsync(TimeSpan expected, AsyncTestDelegate code, string message = null) {}
-    public static TException ThrowsOrAggregates<TException>(TestDelegate code) where TException : Exception {}
-
-    public Assert() {}
-  }
-}
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.1.7.0.
-// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
diff --git a/doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-netstandard2.1.apilist.cs b/doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-netstandard2.1.apilist.cs
deleted file mode 100644
index 41fee4de..00000000
--- a/doc/api-list/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils-netstandard2.1.apilist.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-// Smdn.Test.NUnit.Utils.dll (Smdn.Test.NUnit.Utils-1.0.0)
-//   Name: Smdn.Test.NUnit.Utils
-//   AssemblyVersion: 1.0.0.0
-//   InformationalVersion: 1.0.0+7598ad3f6134b7fcb21ff256682be15e2cd04b61
-//   TargetFramework: .NETStandard,Version=v2.1
-//   Configuration: Release
-//   Referenced assemblies:
-//     System.Text.Encoding.CodePages, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-//     netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
-//     nunit.framework, Version=3.13.2.0, Culture=neutral, PublicKeyToken=2638cd05610744eb
-
-using System;
-using System.IO;
-using System.Runtime.Serialization;
-using System.Text;
-using System.Threading.Tasks;
-using NUnit.Framework;
-
-namespace Smdn.Test.NUnit {
-  public static class Encodings {
-    public static Encoding EucJP { get; }
-    public static Encoding Jis { get; }
-    public static Encoding Latin1 { get; }
-    public static Encoding ShiftJis { get; }
-  }
-
-  public static class IOUtils {
-    public static void UsingCurrentDirectory(string path, Action action) {}
-    public static async Task UsingCurrentDirectoryAsync(string path, Func<Task> action) {}
-    public static void UsingDirectory(string path, Action<DirectoryInfo> action) {}
-    public static void UsingDirectory(string path, bool ensureDirectoryCreated, Action<DirectoryInfo> action) {}
-    public static Task UsingDirectoryAsync(string path, Func<DirectoryInfo, Task> action) {}
-    public static async Task UsingDirectoryAsync(string path, bool ensureDirectoryCreated, Func<DirectoryInfo, Task> action) {}
-    public static void UsingFile(string path, Action<FileInfo> action) {}
-    public static async Task UsingFileAsync(string path, Func<FileInfo, Task> action) {}
-  }
-}
-
-namespace Smdn.Test.NUnit.Assertion {
-  public class Assert : Assert {
-    public static void Elapses(TimeSpan expected, TestDelegate code, string message = null) {}
-    public static void ElapsesAsync(TimeSpan expected, AsyncTestDelegate code, string message = null) {}
-    public static void ElapsesInRange(TimeSpan expectedMin, TimeSpan expectedMax, TestDelegate code, string message = null) {}
-    public static void ElapsesInRangeAsync(TimeSpan expectedMin, TimeSpan expectedMax, AsyncTestDelegate code, string message = null) {}
-    public static void IsSerializable<TSerializable>(TSerializable obj, Action<TSerializable> testDeserializedObject = null) {}
-    public static void IsSerializable<TSerializable>(TSerializable obj, IFormatter serializationFormatter, IFormatter deserializationFormatter, Action<TSerializable> testDeserializedObject = null) {}
-    public static void NotElapse(TimeSpan expected, TestDelegate code, string message = null) {}
-    public static void NotElapseAsync(TimeSpan expected, AsyncTestDelegate code, string message = null) {}
-    public static TException ThrowsOrAggregates<TException>(TestDelegate code) where TException : Exception {}
-
-    public Assert() {}
-  }
-}
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.1.7.0.
-// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)

Full changes

Full changes in this release:
diff --git a/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Assertion/Assert.ExecutionTime.cs b/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Assertion/Assert.ExecutionTime.cs
new file mode 100644
index 00000000..081201d7
--- /dev/null
+++ b/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Assertion/Assert.ExecutionTime.cs
@@ -0,0 +1,54 @@
+// SPDX-FileCopyrightText: 2020 smdn <[email protected]>
+// SPDX-License-Identifier: MIT
+using System;
+using System.Diagnostics;
+using System.Threading.Tasks;
+
+using NUnit.Framework;
+
+namespace Smdn.Test.NUnit.Assertion;
+
+#pragma warning disable IDE0040
+partial class Assert {
+#pragma warning restore IDE0040
+  private static TimeSpan MeasureExecutionTime(TestDelegate code)
+  {
+    var sw = Stopwatch.StartNew();
+
+    code();
+
+    return sw.Elapsed;
+  }
+
+  private static TimeSpan MeasureExecutionTime(AsyncTestDelegate code)
+  {
+    static async Task<TimeSpan> MeasureCore(AsyncTestDelegate c)
+    {
+      var sw = Stopwatch.StartNew();
+
+      await c().ConfigureAwait(false);
+
+      return sw.Elapsed;
+    }
+
+    return MeasureCore(code).GetAwaiter().GetResult(); // XXX
+  }
+
+  public static void Elapses(TimeSpan expected, TestDelegate code, string message = null)
+    => That(MeasureExecutionTime(code ?? throw new ArgumentNullException(nameof(code))), Is.GreaterThanOrEqualTo(expected), message ?? "elapses");
+
+  public static void ElapsesAsync(TimeSpan expected, AsyncTestDelegate code, string message = null)
+    => That(MeasureExecutionTime(code ?? throw new ArgumentNullException(nameof(code))), Is.GreaterThanOrEqualTo(expected), message ?? "elapses");
+
+  public static void NotElapse(TimeSpan expected, TestDelegate code, string message = null)
+    => That(MeasureExecutionTime(code ?? throw new ArgumentNullException(nameof(code))), Is.LessThanOrEqualTo(expected), message ?? "not elapse");
+
+  public static void NotElapseAsync(TimeSpan expected, AsyncTestDelegate code, string message = null)
+    => That(MeasureExecutionTime(code ?? throw new ArgumentNullException(nameof(code))), Is.LessThanOrEqualTo(expected), message ?? "not elapse");
+
+  public static void ElapsesInRange(TimeSpan expectedMin, TimeSpan expectedMax, TestDelegate code, string message = null)
+    => That(MeasureExecutionTime(code ?? throw new ArgumentNullException(nameof(code))), Is.InRange(expectedMin, expectedMax), message ?? "elapses in range");
+
+  public static void ElapsesInRangeAsync(TimeSpan expectedMin, TimeSpan expectedMax, AsyncTestDelegate code, string message = null)
+    => That(MeasureExecutionTime(code ?? throw new ArgumentNullException(nameof(code))), Is.InRange(expectedMin, expectedMax), message ?? "elapses in range");
+}
diff --git a/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Assertion/Assert.Serialization.cs b/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Assertion/Assert.Serialization.cs
index 19b69f66..8658e7e6 100644
--- a/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Assertion/Assert.Serialization.cs
+++ b/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Assertion/Assert.Serialization.cs
@@ -11,7 +11,9 @@ using System.Runtime.Serialization.Formatters.Binary;
 
 namespace Smdn.Test.NUnit.Assertion;
 
-public partial class Assert {
+#pragma warning disable IDE0040
+partial class Assert {
+#pragma warning restore IDE0040
 #if SYSTEM_RUNTIME_SERIALIZATION_IFORMATTER
   private static IFormatter CreateDefaultSerializationFormatter()
 #if SYSTEM_RUNTIME_SERIALIZATION_FORMATTER_BINARY
diff --git a/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Assertion/Assert.cs b/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Assertion/Assert.cs
index ebde896a..3bef33ef 100644
--- a/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Assertion/Assert.cs
+++ b/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Assertion/Assert.cs
@@ -1,61 +1,23 @@
 // SPDX-FileCopyrightText: 2020 smdn <[email protected]>
 // SPDX-License-Identifier: MIT
 using System;
-using System.Diagnostics;
-using System.Threading.Tasks;
+
 using NUnit.Framework;
+using NUnit.Framework.Legacy;
 
 namespace Smdn.Test.NUnit.Assertion;
 
-public partial class Assert : global::NUnit.Framework.Assert {
-  private static TimeSpan MeasureExecutionTime(TestDelegate code)
-  {
-    var sw = Stopwatch.StartNew();
-
-    code();
-
-    return sw.Elapsed;
-  }
-
-  private static TimeSpan MeasureExecutionTime(AsyncTestDelegate code)
-  {
-    static async Task<TimeSpan> MeasureCore(AsyncTestDelegate c)
-    {
-      var sw = Stopwatch.StartNew();
-
-      await c().ConfigureAwait(false);
-
-      return sw.Elapsed;
-    }
-
-    return MeasureCore(code).GetAwaiter().GetResult(); // XXX
-  }
-
-  public static void Elapses(TimeSpan expected, TestDelegate code, string message = null)
-    => That(MeasureExecutionTime(code), Is.GreaterThanOrEqualTo(expected), message ?? "elapses");
-
-  public static void ElapsesAsync(TimeSpan expected, AsyncTestDelegate code, string message = null)
-    => That(MeasureExecutionTime(code), Is.GreaterThanOrEqualTo(expected), message ?? "elapses");
-
-  public static void NotElapse(TimeSpan expected, TestDelegate code, string message = null)
-    => That(MeasureExecutionTime(code), Is.LessThanOrEqualTo(expected), message ?? "not elapse");
-
-  public static void NotElapseAsync(TimeSpan expected, AsyncTestDelegate code, string message = null)
-    => That(MeasureExecutionTime(code), Is.LessThanOrEqualTo(expected), message ?? "not elapse");
-
-  public static void ElapsesInRange(TimeSpan expectedMin, TimeSpan expectedMax, TestDelegate code, string message = null)
-    => That(MeasureExecutionTime(code), Is.InRange(expectedMin, expectedMax), message ?? "elapses in range");
-
-  public static void ElapsesInRangeAsync(TimeSpan expectedMin, TimeSpan expectedMax, AsyncTestDelegate code, string message = null)
-    => That(MeasureExecutionTime(code), Is.InRange(expectedMin, expectedMax), message ?? "elapses in range");
-
+public partial class Assert : global::NUnit.Framework.Legacy.ClassicAssert {
   public static TException ThrowsOrAggregates<TException>(TestDelegate code)
     where TException : Exception
   {
+    if (code is null)
+      throw new ArgumentNullException(nameof(code));
+
     try {
       code();
 
-      Fail("expected exception {0} not thrown", typeof(TException).FullName);
+      Fail($"expected exception {typeof(TException).FullName} not thrown");
 
       return null;
     }
@@ -67,10 +29,12 @@ public partial class Assert : global::NUnit.Framework.Assert {
 
       return ex.InnerException as TException;
     }
+#pragma warning disable CA1031
     catch (Exception ex) {
       IsInstanceOf<TException>(ex);
 
       return ex as TException;
     }
+#pragma warning restore CA1031
   }
 }
diff --git a/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Assertion/DeserializationBinder.cs b/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Assertion/DeserializationBinder.cs
index 4e8c0410..a984d193 100644
--- a/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Assertion/DeserializationBinder.cs
+++ b/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Assertion/DeserializationBinder.cs
@@ -56,9 +56,7 @@ internal sealed class DeserializationBinder : SerializationBinder {
     // try to get type
     var typeToDeserialize =
       Type.GetType(typeName, throwOnError: false) ??
-      GetTypeFromLoadedAssemblies(typeName);
-
-    if (typeToDeserialize is null)
+      GetTypeFromLoadedAssemblies(typeName) ??
       throw new InvalidOperationException($"could not bind to type: {typeName}, {assemblyName}");
 
     if (string.Equals(assemblyName, typeToDeserialize.Assembly.FullName, StringComparison.Ordinal))
diff --git a/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils.csproj b/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils.csproj
index 20c0aa4e..110da0e4 100644
--- a/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils.csproj
+++ b/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit.Utils.csproj
@@ -4,11 +4,12 @@ SPDX-License-Identifier: MIT
 -->
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
-    <TargetFrameworks>net6.0;net472;net45;netstandard2.1;netstandard2.0</TargetFrameworks>
-    <VersionPrefix>1.0.0</VersionPrefix>
+    <TargetFrameworks>net6.0;net472;net462</TargetFrameworks>
+    <VersionPrefix>4.0.0</VersionPrefix>
     <VersionSuffix></VersionSuffix>
-    <!-- <PackageValidationBaselineVersion>1.0.0</PackageValidationBaselineVersion> -->
     <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
+    <EnableTrimAnalyzer>false</EnableTrimAnalyzer>
+    <RootNamespace/> <!-- empty the root namespace so that the namespace is determined only by the directory name, for code style rule IDE0030 -->
   </PropertyGroup>
 
   <PropertyGroup Label="assembly attributes">
@@ -23,6 +24,6 @@ SPDX-License-Identifier: MIT
   <ItemGroup>
     <PackageReference Include="System.Text.Encoding.CodePages" />
     <PackageReference Include="System.Runtime.Serialization.Formatters" />
-    <PackageReference Include="NUnit" Version="[3.13.2,4.0.0)" />
+    <PackageReference Include="NUnit" Version="[4.0.0,5.0.0)" />
   </ItemGroup>
 </Project>
diff --git a/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit/Encodings.cs b/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit/Encodings.cs
index 37f3f3f2..10c2c5e6 100644
--- a/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit/Encodings.cs
+++ b/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit/Encodings.cs
@@ -4,7 +4,9 @@ using System.Text;
 
 namespace Smdn.Test.NUnit;
 
+#pragma warning disable CA1724
 public static class Encodings {
+#pragma warning restore CA1724
   public static Encoding Latin1 =>
 #if SYSTEM_TEXT_ENCODING_LATIN1
     Encoding.Latin1;
diff --git a/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit/IOUtils.cs b/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit/IOUtils.cs
index 2b89a6b6..9dc17f77 100644
--- a/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit/IOUtils.cs
+++ b/src/Smdn.Test.NUnit.Utils/Smdn.Test.NUnit/IOUtils.cs
@@ -12,6 +12,9 @@ namespace Smdn.Test.NUnit;
 public static class IOUtils {
   public static void UsingCurrentDirectory(string path, Action action)
   {
+    if (action is null)
+      throw new ArgumentNullException(nameof(action));
+
     var initialDirectory = Directory.GetCurrentDirectory();
 
     try {
@@ -26,6 +29,9 @@ public static class IOUtils {
 
   public static async Task UsingCurrentDirectoryAsync(string path, Func<Task> action)
   {
+    if (action is null)
+      throw new ArgumentNullException(nameof(action));
+
     var initialDirectory = Directory.GetCurrentDirectory();
 
     try {
@@ -43,13 +49,16 @@ public static class IOUtils {
 
   public static void UsingDirectory(string path, bool ensureDirectoryCreated, Action<DirectoryInfo> action)
   {
+    if (action is null)
+      throw new ArgumentNullException(nameof(action));
+
     try {
       TryDeleteDirectory(path);
 
       var directory = new DirectoryInfo(path);
 
       if (ensureDirectoryCreated)
-        TryIO(() => directory.Create());
+        TryIO(directory.Create);
 
       action(directory);
     }
@@ -63,13 +72,16 @@ public static class IOUtils {
 
   public static async Task UsingDirectoryAsync(string path, bool ensureDirectoryCreated, Func<DirectoryInfo, Task> action)
   {
+    if (action is null)
+      throw new ArgumentNullException(nameof(action));
+
     try {
       TryDeleteDirectory(path);
 
       var directory = new DirectoryInfo(path);
 
       if (ensureDirectoryCreated)
-        TryIO(() => directory.Create());
+        TryIO(directory.Create);
 
       await action(directory).ConfigureAwait(false);
     }
@@ -86,29 +98,35 @@ public static class IOUtils {
 
   public static void UsingFile(string path, Action<FileInfo> action)
   {
+    if (action is null)
+      throw new ArgumentNullException(nameof(action));
+
     var file = new FileInfo(path);
 
     try {
-      TryIO(() => file.Delete());
+      TryIO(file.Delete);
 
       action(file);
     }
     finally {
-      TryIO(() => file.Delete());
+      TryIO(file.Delete);
     }
   }
 
   public static async Task UsingFileAsync(string path, Func<FileInfo, Task> action)
   {
+    if (action is null)
+      throw new ArgumentNullException(nameof(action));
+
     var file = new FileInfo(path);
 
     try {
-      TryIO(() => file.Delete());
+      TryIO(file.Delete);
 
       await action(file).ConfigureAwait(false);
     }
     finally {
-      TryIO(() => file.Delete());
+      TryIO(file.Delete);
     }
   }
 

Notes

Full Changelog: releases/Smdn.Test.NUnit.Utils-1.0.0...releases/Smdn.Test.NUnit.Utils-4.0.0