This is an automated email from the ASF dual-hosted git repository. freeandnil pushed a commit to branch Feature/118-nullability in repository https://gitbox.apache.org/repos/asf/logging-log4net.git
commit c31fb61e488d7ae1ef296281098bd341e9fda788 Author: Erik Mavrinac <[email protected]> AuthorDate: Fri Mar 8 14:50:02 2024 -0800 Fix remaining reflection in tests, fix net462 tests by removing 3 NExpect usages that conflict with lack of strong naming in NExpect --- src/log4net.Tests/Context/ThreadContextTest.cs | 7 ++----- src/log4net.Tests/Core/FixingTest.cs | 7 +------ src/log4net.Tests/Signing.cs | 6 +----- src/log4net.Tests/log4net.Tests.csproj | 1 - 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/log4net.Tests/Context/ThreadContextTest.cs b/src/log4net.Tests/Context/ThreadContextTest.cs index b34af135..f08a63cb 100644 --- a/src/log4net.Tests/Context/ThreadContextTest.cs +++ b/src/log4net.Tests/Context/ThreadContextTest.cs @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Threading; using log4net.Config; using log4net.Layout; @@ -28,8 +29,6 @@ using log4net.Repository; using log4net.Tests.Appender; using log4net.Util; using NUnit.Framework; -using static NExpect.Expectations; -using NExpect; namespace log4net.Tests.Context { @@ -252,9 +251,7 @@ namespace log4net.Tests.Context t.Join(); } - // Assert - Expect(flags) - .To.Contain.All.Matched.By(o => o.Flag == false); + Assert.IsTrue(flags.All(o => !o.Flag)); } public class FlagContainer diff --git a/src/log4net.Tests/Core/FixingTest.cs b/src/log4net.Tests/Core/FixingTest.cs index c66fd85d..7f23c5d0 100644 --- a/src/log4net.Tests/Core/FixingTest.cs +++ b/src/log4net.Tests/Core/FixingTest.cs @@ -24,13 +24,9 @@ using System.Threading; using log4net.Core; using NUnit.Framework; -using static NExpect.Expectations; -using NExpect; namespace log4net.Tests.Core { - /// <summary> - /// </<summary> [TestFixture] public class FixingTest { @@ -75,8 +71,7 @@ namespace log4net.Tests.Core // Assert foreach (var flag in allFlags) { - Expect(FixFlags.All & flag) - .To.Equal(flag, () => $"FixFlags.All does not contain {flag}"); + Assert.AreEqual(flag, FixFlags.All & flag, $"FixFlags.All does not contain {flag}"); } } diff --git a/src/log4net.Tests/Signing.cs b/src/log4net.Tests/Signing.cs index 93d45563..6716b8cd 100644 --- a/src/log4net.Tests/Signing.cs +++ b/src/log4net.Tests/Signing.cs @@ -1,7 +1,5 @@ using log4net.Repository; using NUnit.Framework; -using NExpect; -using static NExpect.Expectations; namespace log4net.Tests { @@ -15,9 +13,7 @@ namespace log4net.Tests var asm = typeof(LoggerRepositorySkeleton).Assembly; // Act var result = asm.GetName().GetPublicKey(); - // Assert - Expect(result) - .Not.To.Be.Empty(); + Assert.AreNotEqual(0, result.Length); } } } \ No newline at end of file diff --git a/src/log4net.Tests/log4net.Tests.csproj b/src/log4net.Tests/log4net.Tests.csproj index 854bc6ad..d285463e 100644 --- a/src/log4net.Tests/log4net.Tests.csproj +++ b/src/log4net.Tests/log4net.Tests.csproj @@ -65,7 +65,6 @@ </PackageReference> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" /> <PackageReference Include="NUnit" Version="3.14.0" /> - <PackageReference Include="NExpect" Version="2.0.78" /> <PackageReference Include="Quackers.TestLogger" Version="1.0.24" /> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)'=='net462'">
