diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 42f79e0..af9b561 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "dotnet-reportgenerator-globaltool": { - "version": "5.3.8", + "version": "5.3.10", "commands": [ "reportgenerator" ] diff --git a/.github/workflows/dotnet-core.yml b/.github/workflows/dotnet-core.yml index e08fb5a..9c4265f 100644 --- a/.github/workflows/dotnet-core.yml +++ b/.github/workflows/dotnet-core.yml @@ -1,4 +1,4 @@ -name: .NET Core Builds +name: .NET Core Build on: push: diff --git a/Test.AMT.Extensions.Logging/IP/UdpLoggerOptionsTests.cs b/Test.AMT.Extensions.Logging/IP/UdpLoggerOptionsTests.cs new file mode 100644 index 0000000..4258339 --- /dev/null +++ b/Test.AMT.Extensions.Logging/IP/UdpLoggerOptionsTests.cs @@ -0,0 +1,26 @@ +// Copyright (c) AltaModa Technologies. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Ext = AMT.Extensions.Logging.IP; +using FluentAssertions; +using System; +using System.Diagnostics.CodeAnalysis; +using Xunit; + + +namespace Test.AMT.Extensions.Logging.IP +{ + [ExcludeFromCodeCoverage] + public class UdpLoggerOptionsTests + { + + [Fact] + public void excp_on_null_IP_endpoint() + { + Action act = () => new Ext.UdpLoggerOptions(null); + act.Should().Throw(); + } + + } + +} diff --git a/Test.AMT.Extensions.Logging/IP/UdpLoggerProviderTests.cs b/Test.AMT.Extensions.Logging/IP/UdpLoggerProviderTests.cs new file mode 100644 index 0000000..7042e72 --- /dev/null +++ b/Test.AMT.Extensions.Logging/IP/UdpLoggerProviderTests.cs @@ -0,0 +1,51 @@ +// Copyright (c) AltaModa Technologies. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Ext = AMT.Extensions.Logging.IP; +using FluentAssertions; +using System; +using System.Diagnostics.CodeAnalysis; +using Xunit; +using AMT.Extensions.Logging.IP; +using Microsoft.Extensions.Logging; +using System.Configuration.Provider; + + +namespace Test.AMT.Extensions.Logging.IP +{ + [ExcludeFromCodeCoverage] + public class UdpLoggerProviderTests + { + + [Fact] + public void excp_on_null_options() + { + Action act = () => new Ext.UdpLoggerProvider(null); + act.Should().Throw(); + } + + + #region ILoggerProvider tests + + [Fact] + public void foo() + { + var udpProv = new Ext.UdpLoggerProvider(_opts); + + ILoggerProvider prov = udpProv as ILoggerProvider; + Assert.NotNull(prov); + + ILogger l = prov.CreateLogger("randomCategory"); + Assert.NotNull(l); + + l.LogInformation("using ILogger.LogInformation..."); + + } + + #endregion ILoggerProvider tests + + + private static readonly UdpLoggerOptions _opts = new UdpLoggerOptions(); + } + +} diff --git a/Test.AMT.Extensions.Logging/IP/UdpLoggerTests.cs b/Test.AMT.Extensions.Logging/IP/UdpLoggerTests.cs index fbf4bd5..6ddd528 100644 --- a/Test.AMT.Extensions.Logging/IP/UdpLoggerTests.cs +++ b/Test.AMT.Extensions.Logging/IP/UdpLoggerTests.cs @@ -30,18 +30,19 @@ public void verify_each_loglevel() _provider = new Ext.UdpLoggerProvider(opts); var logger = _provider.CreateLogger("test") as Ext.UdpLogger; + // Log a message of each LogLevel foreach (int level in _logLevels) { - // Log some messages logger.Log((LogLevel)level, DEFAULT_EVENTID, DEFAULT_STATE, DEFAULT_EXCEPTION, setStringFormatter); } - // Brief wait & stop listener + // Brief wait, then stop listener System.Threading.Thread.Sleep(100); _receiver.Stop(); // NOTE: RetrieveMessages returns a _consuming_ enumerator, so it can only be used once. - _receiver.RetrieveMessages().Count().Should().Be(_logLevels.Length - 1); // -1 since None shouldn't be logged + // 2024.09.17, JB: previously None was filtered, but it seems that changed in logging fx. + _receiver.RetrieveMessages().Count().Should().Be(_logLevels.Length); } }