Skip to content

Commit

Permalink
Merge branch 'master' into netstandard2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jburnett committed Oct 1, 2024
2 parents f14889d + a3ddb83 commit 892e929
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"dotnet-reportgenerator-globaltool": {
"version": "5.3.8",
"version": "5.3.10",
"commands": [
"reportgenerator"
]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: .NET Core Builds
name: .NET Core Build

on:
push:
Expand Down
26 changes: 26 additions & 0 deletions Test.AMT.Extensions.Logging/IP/UdpLoggerOptionsTests.cs
Original file line number Diff line number Diff line change
@@ -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<ArgumentNullException>();
}

}

}
51 changes: 51 additions & 0 deletions Test.AMT.Extensions.Logging/IP/UdpLoggerProviderTests.cs
Original file line number Diff line number Diff line change
@@ -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<ArgumentNullException>();
}


#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();
}

}
7 changes: 4 additions & 3 deletions Test.AMT.Extensions.Logging/IP/UdpLoggerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 892e929

Please sign in to comment.