diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index acd3bc6..8b34c29 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: - name: Setup uses: actions/setup-dotnet@v4 with: - dotnet-version: 9.0.x + dotnet-version: 10.0.x - name: Compute build number shell: bash run: | diff --git a/Directory.Version.props b/Directory.Version.props index 8c3cc16..e0c7503 100644 --- a/Directory.Version.props +++ b/Directory.Version.props @@ -1,6 +1,6 @@ - 9.0.0 + 10.0.0 diff --git a/README.md b/README.md index 17d3910..68cc3ee 100644 --- a/README.md +++ b/README.md @@ -340,7 +340,7 @@ Destructuring means extracting pieces of information from an object and create p ], ``` -This is how the first destructuring policy would look like: +This is how the first destructuring policy would look: ```csharp namespace MyFirstNamespace; diff --git a/global.json b/global.json index db8627a..7ca72cb 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "9.0.100", + "version": "10.0.100", "allowPrerelease": false, "rollForward": "latestFeature" } diff --git a/sample/Sample/Sample.csproj b/sample/Sample/Sample.csproj index 1c8a2a7..5ad3694 100644 --- a/sample/Sample/Sample.csproj +++ b/sample/Sample/Sample.csproj @@ -1,7 +1,7 @@  - net462;net8.0;net9.0 + net462;net8.0;net9.0;net10.0 Exe false @@ -15,14 +15,14 @@ - + - - + + - + - + diff --git a/serilog-settings-configuration.sln.DotSettings b/serilog-settings-configuration.sln.DotSettings index d47fb00..a4c38e4 100644 --- a/serilog-settings-configuration.sln.DotSettings +++ b/serilog-settings-configuration.sln.DotSettings @@ -560,6 +560,7 @@ II.2.12 <HandlesEvent /> True True True + True True True True diff --git a/serilog-settings-configuration.sln.DotSettings.user b/serilog-settings-configuration.sln.DotSettings.user new file mode 100644 index 0000000..f89107c --- /dev/null +++ b/serilog-settings-configuration.sln.DotSettings.user @@ -0,0 +1,5 @@ + + <SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Solution" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> + <Solution /> +</SessionState> + \ No newline at end of file diff --git a/src/Serilog.Settings.Configuration/Serilog.Settings.Configuration.csproj b/src/Serilog.Settings.Configuration/Serilog.Settings.Configuration.csproj index 51e9589..26f0666 100644 --- a/src/Serilog.Settings.Configuration/Serilog.Settings.Configuration.csproj +++ b/src/Serilog.Settings.Configuration/Serilog.Settings.Configuration.csproj @@ -5,7 +5,7 @@ Serilog Contributors - net462;netstandard2.0;net8.0;net9.0 + net462;netstandard2.0;net8.0;net9.0;net10.0 serilog;json;appsettings icon.png README.md @@ -16,8 +16,8 @@ - - + + @@ -25,7 +25,7 @@ - - + + diff --git a/test/Serilog.Settings.Configuration.Tests/PublishSingleFileTests.cs b/test/Serilog.Settings.Configuration.Tests/PublishSingleFileTests.cs index c2f5d33..b2c9cd0 100644 --- a/test/Serilog.Settings.Configuration.Tests/PublishSingleFileTests.cs +++ b/test/Serilog.Settings.Configuration.Tests/PublishSingleFileTests.cs @@ -2,30 +2,21 @@ using System.Text; using CliWrap; using CliWrap.Exceptions; -using FluentAssertions; -using FluentAssertions.Execution; using Serilog.Settings.Configuration.Tests.Support; using Xunit.Abstractions; namespace Serilog.Settings.Configuration.Tests; [Trait("Category", "Integration")] -public sealed class PublishSingleFileTests : IDisposable, IClassFixture +public sealed class PublishSingleFileTests : IClassFixture { readonly ITestOutputHelper _outputHelper; readonly TestApp _testApp; - readonly AssertionScope _scope; public PublishSingleFileTests(ITestOutputHelper outputHelper, TestApp testApp) { _outputHelper = outputHelper; _testApp = testApp; - _scope = new AssertionScope(); - } - - public void Dispose() - { - _scope.Dispose(); } [Theory] @@ -33,8 +24,8 @@ public void Dispose() public async Task RunTestApp_NoUsingAndNoAssembly(PublishMode publishMode) { var (isSingleFile, stdOut, stdErr) = await RunTestAppAsync(publishMode); - stdOut.Should().Be(isSingleFile ? "Expected exception" : "(Main thread) [Information] Expected success"); - stdErr.Should().BeEmpty(); + Assert.Equal(stdOut, isSingleFile ? "Expected exception" : "(Main thread) [Information] Expected success"); + Assert.Empty(stdErr); } [Theory] @@ -42,11 +33,11 @@ public async Task RunTestApp_NoUsingAndNoAssembly(PublishMode publishMode) public async Task RunTestApp_UsingConsole(PublishMode publishMode) { var (isSingleFile, stdOut, stdErr) = await RunTestAppAsync(publishMode, "--using-console"); - stdOut.Should().Be(isSingleFile ? "() [Information] Expected success" : "(Main thread) [Information] Expected success"); + Assert.Equal(stdOut, isSingleFile ? "() [Information] Expected success" : "(Main thread) [Information] Expected success"); if (isSingleFile) - stdErr.Should().Contain("Unable to find a method called WithThreadName"); + Assert.Contains("Unable to find a method called WithThreadName", stdErr); else - stdErr.Should().BeEmpty(); + Assert.Empty(stdErr); } [Theory] @@ -54,11 +45,11 @@ public async Task RunTestApp_UsingConsole(PublishMode publishMode) public async Task RunTestApp_UsingThread(PublishMode publishMode) { var (isSingleFile, stdOut, stdErr) = await RunTestAppAsync(publishMode, "--using-thread"); - stdOut.Should().Be(isSingleFile ? "" : "(Main thread) [Information] Expected success"); + Assert.Equal(stdOut, isSingleFile ? "" : "(Main thread) [Information] Expected success"); if (isSingleFile) - stdErr.Should().Contain("Unable to find a method called Console"); + Assert.Contains("Unable to find a method called Console", stdErr); else - stdErr.Should().BeEmpty(); + Assert.Empty(stdErr); } [Theory] @@ -66,8 +57,8 @@ public async Task RunTestApp_UsingThread(PublishMode publishMode) public async Task RunTestApp_AssemblyThread(PublishMode publishMode) { var (_, stdOut, stdErr) = await RunTestAppAsync(publishMode, "--assembly-thread"); - stdOut.Should().BeEmpty(); - stdErr.Should().Contain("Unable to find a method called Console"); + Assert.Empty(stdOut); + Assert.Contains("Unable to find a method called Console", stdErr); } [Theory] @@ -75,8 +66,8 @@ public async Task RunTestApp_AssemblyThread(PublishMode publishMode) public async Task RunTestApp_AssemblyConsole(PublishMode publishMode) { var (_, stdOut, stdErr) = await RunTestAppAsync(publishMode, "--assembly-console"); - stdOut.Should().Be("() [Information] Expected success"); - stdErr.Should().Contain("Unable to find a method called WithThreadName"); + Assert.Equal("() [Information] Expected success", stdOut); + Assert.Contains("Unable to find a method called WithThreadName", stdErr); } [Theory] @@ -84,8 +75,8 @@ public async Task RunTestApp_AssemblyConsole(PublishMode publishMode) public async Task RunTestApp_ConsoleAndThread(PublishMode publishMode, string strategy) { var (_, stdOut, stdErr) = await RunTestAppAsync(publishMode, $"--{strategy}-console", $"--{strategy}-thread"); - stdOut.Should().Be("(Main thread) [Information] Expected success"); - stdErr.Should().BeEmpty(); + Assert.Equal("(Main thread) [Information] Expected success", stdOut); + Assert.Empty(stdErr); } [Theory] @@ -93,8 +84,8 @@ public async Task RunTestApp_ConsoleAndThread(PublishMode publishMode, string st public async Task RunTestApp_ConfigureMinimumLevelOnly(PublishMode publishMode) { var (_, stdOut, stdErr) = await RunTestAppAsync(publishMode, "--minimum-level-only"); - stdOut.Should().Be("(Main thread) [Information] Expected success"); - stdErr.Should().BeEmpty(); + Assert.Equal("(Main thread) [Information] Expected success", stdOut); + Assert.Empty(stdErr); } async Task<(bool IsSingleFile, string StdOut, string StdErr)> RunTestAppAsync(PublishMode publishMode, params string[] args) diff --git a/test/Serilog.Settings.Configuration.Tests/Serilog.Settings.Configuration.Tests.csproj b/test/Serilog.Settings.Configuration.Tests/Serilog.Settings.Configuration.Tests.csproj index d3ac6cc..d70d65c 100644 --- a/test/Serilog.Settings.Configuration.Tests/Serilog.Settings.Configuration.Tests.csproj +++ b/test/Serilog.Settings.Configuration.Tests/Serilog.Settings.Configuration.Tests.csproj @@ -2,7 +2,7 @@ net48 - $(TargetFrameworks);net8.0;net9.0 + $(TargetFrameworks);net8.0;net9.0;net10.0 false false @@ -19,17 +19,19 @@ - - - - - - - - - - - + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/test/Serilog.Settings.Configuration.Tests/Support/TestApp.cs b/test/Serilog.Settings.Configuration.Tests/Support/TestApp.cs index 7cf4183..69a01d3 100644 --- a/test/Serilog.Settings.Configuration.Tests/Support/TestApp.cs +++ b/test/Serilog.Settings.Configuration.Tests/Support/TestApp.cs @@ -3,7 +3,6 @@ using System.Text; using CliWrap; using CliWrap.Exceptions; -using FluentAssertions; using Polly; using Xunit.Abstractions; using Xunit.Sdk; @@ -108,16 +107,18 @@ async Task PublishAsync(PublishMode publishMode) var executableFileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "TestApp.exe" : "TestApp"; var executableFile = new FileInfo(Path.Combine(outputDirectory.FullName, executableFileName)); - executableFile.Exists.Should().BeTrue(); + Assert.True(executableFile.Exists); var dlls = executableFile.Directory!.EnumerateFiles("*.dll"); if (publishMode == PublishMode.Standard) { - dlls.Should().NotBeEmpty(because: $"the test app was _not_ published as single-file ({publishMode})"); + // the test app was _not_ published as single-file + Assert.NotEmpty(dlls); } else { - dlls.Should().BeEmpty(because: $"the test app was published as single-file ({publishMode})"); - executableFile.Directory.EnumerateFiles().Should().ContainSingle().Which.FullName.Should().Be(executableFile.FullName); + // the test app was published as single-file + Assert.Empty(dlls); + Assert.Single(executableFile.Directory.EnumerateFiles(), f => f.FullName == executableFile.FullName); } _executables[publishMode] = executableFile; diff --git a/test/TestApp-net9.0/.gitignore b/test/TestApp-net9.0/.gitignore deleted file mode 100644 index 1cc29f1..0000000 --- a/test/TestApp-net9.0/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -FodyWeavers.xml -FodyWeavers.xsd diff --git a/test/TestApp-net9.0/Program.cs b/test/TestApp-net9.0/Program.cs deleted file mode 100644 index 033b43d..0000000 --- a/test/TestApp-net9.0/Program.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System.Reflection; -using Microsoft.Extensions.Configuration; -using Serilog; -using Serilog.Debugging; -using Serilog.Settings.Configuration; - -if (args.Length == 1 && args[0] == "is-single-file") -{ - if (typeof(Program).Assembly.GetManifestResourceNames().Any(e => e.StartsWith("costura."))) - { - Console.WriteLine(true); - return 0; - } - // IL3000: 'System.Reflection.Assembly.Location' always returns an empty string for assemblies embedded in a single-file app -#pragma warning disable IL3000 - Console.WriteLine(string.IsNullOrEmpty(Assembly.GetEntryAssembly()?.Location)); -#pragma warning restore - return 0; -} - -SelfLog.Enable(Console.Error); - -Thread.CurrentThread.Name = "Main thread"; -const string outputTemplate = "({ThreadName}) [{Level}] {Message}{NewLine}"; - -var configurationValues = new Dictionary(); -var minimumLevelOnly = args.Contains("--minimum-level-only"); -if (minimumLevelOnly) -{ - configurationValues["Serilog:MinimumLevel"] = "Verbose"; -} -else -{ - configurationValues["Serilog:Enrich:0"] = "WithThreadName"; - configurationValues["Serilog:WriteTo:0:Name"] = "Console"; - configurationValues["Serilog:WriteTo:0:Args:outputTemplate"] = outputTemplate; -} - -if (args.Contains("--using-thread")) configurationValues["Serilog:Using:Thread"] = "Serilog.Enrichers.Thread"; -if (args.Contains("--using-console")) configurationValues["Serilog:Using:Console"] = "Serilog.Sinks.Console"; - -var assemblies = new List(); -if (args.Contains("--assembly-thread")) assemblies.Add(typeof(ThreadLoggerConfigurationExtensions).Assembly); -if (args.Contains("--assembly-console")) assemblies.Add(typeof(ConsoleLoggerConfigurationExtensions).Assembly); - -try -{ - var configuration = new ConfigurationBuilder().AddInMemoryCollection(configurationValues).Build(); - var options = assemblies.Count > 0 ? new ConfigurationReaderOptions(assemblies.ToArray()) : null; - var loggerConfiguration = new LoggerConfiguration().ReadFrom.Configuration(configuration, options); - if (minimumLevelOnly) - { - loggerConfiguration - .Enrich.WithThreadName() - .WriteTo.Console(outputTemplate: outputTemplate); - } - var logger = loggerConfiguration.CreateLogger(); - logger.Information("Expected success"); - return 0; -} -catch (InvalidOperationException exception) when (exception.Message.StartsWith("No Serilog:Using configuration section is defined and no Serilog assemblies were found.")) -{ - Console.WriteLine("Expected exception"); - return 0; -} -catch (Exception exception) -{ - Console.Error.WriteLine(exception); - return 1; -} diff --git a/test/TestApp-net9.0/Serilog.Settings.Configuration.0.0.0-IntegrationTest.0.snupkg b/test/TestApp-net9.0/Serilog.Settings.Configuration.0.0.0-IntegrationTest.0.snupkg deleted file mode 100644 index bf7bdf1..0000000 Binary files a/test/TestApp-net9.0/Serilog.Settings.Configuration.0.0.0-IntegrationTest.0.snupkg and /dev/null differ diff --git a/test/TestApp-net9.0/TestApp.csproj b/test/TestApp-net9.0/TestApp.csproj deleted file mode 100644 index 585e706..0000000 --- a/test/TestApp-net9.0/TestApp.csproj +++ /dev/null @@ -1,33 +0,0 @@ - - - - Exe - net48 - embedded - false - false - false - none - true - true - false - - NU1902;NU1903 - - - - - - - - - - - - - - - - - - diff --git a/test/TestApp-net9.0/nuget.config b/test/TestApp-net9.0/nuget.config deleted file mode 100644 index cfec8fc..0000000 --- a/test/TestApp-net9.0/nuget.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/test/TestApp/TestApp.csproj b/test/TestApp/TestApp.csproj index 585e706..1978c2e 100644 --- a/test/TestApp/TestApp.csproj +++ b/test/TestApp/TestApp.csproj @@ -11,8 +11,7 @@ true true false - - NU1902;NU1903 + false @@ -24,10 +23,10 @@ - - + + - + diff --git a/test/TestDummies/TestDummies.csproj b/test/TestDummies/TestDummies.csproj index 43f8c6d..10da4ba 100644 --- a/test/TestDummies/TestDummies.csproj +++ b/test/TestDummies/TestDummies.csproj @@ -6,12 +6,12 @@ - + - +