Skip to content

Commit 7bcf537

Browse files
committed
Test
1 parent 846d2e9 commit 7bcf537

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

build.cake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@ Task("Test")
7979
.IsDependentOn("Compile")
8080
.Does(() =>
8181
{
82-
var projects = GetFiles("./test/**/*.csproj")
82+
var projects = GetFiles("./test/DotNetty.Common.Tests/*.csproj")
8383
- GetFiles("./test/**/*.Microbench.csproj")
8484
- GetFiles("./test/**/*.Performance.csproj");
8585

8686
foreach(var project in projects)
8787
{
8888
DotNetCoreTest(project.FullPath, new DotNetCoreTestSettings
8989
{
90-
Configuration = configuration//,
91-
//Verbose = false
90+
Configuration = configuration,
91+
Verbose = true
9292
});
9393

9494
// if (IsRunningOnWindows())

test/DotNetty.Common.Tests/Internal/Logging/InternalLoggerFactoryTest.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,23 @@
44
namespace DotNetty.Common.Tests.Internal.Logging
55
{
66
using System;
7+
using System.Runtime.CompilerServices;
78
using DotNetty.Common.Internal.Logging;
89
using DotNetty.Tests.Common;
910
using Microsoft.Extensions.Logging;
1011
using Moq;
1112
using Xunit;
13+
using Xunit.Abstractions;
1214

1315
[CollectionDefinition(nameof(InternalLoggerFactoryTest), DisableParallelization = true)]
1416
public class InternalLoggerFactoryTest
1517
{
18+
protected readonly ITestOutputHelper Output;
19+
20+
protected InternalLoggerFactoryTest(ITestOutputHelper output)
21+
{
22+
this.Output = output;
23+
}
1624
// todo: CodeContracts on CI
1725
//[Fact]
1826
//public void ShouldNotAllowNullDefaultFactory()
@@ -34,6 +42,7 @@ public void ShouldGetInstance()
3442
[Fact]
3543
public void TestMockReturned()
3644
{
45+
Output.WriteLine("TestMockReturned, Pre:" + RuntimeHelpers.GetHashCode(InternalLoggerFactory.DefaultFactory));
3746
Mock<ILogger> mock;
3847
using (SetupMockLogger(out mock))
3948
{
@@ -43,20 +52,27 @@ public void TestMockReturned()
4352

4453
Assert.True(logger.TraceEnabled);
4554
mock.Verify(x => x.IsEnabled(LogLevel.Trace), Times.Once);
55+
Output.WriteLine("TestMockReturned, Finish:" + RuntimeHelpers.GetHashCode(InternalLoggerFactory.DefaultFactory));
4656
}
57+
Output.WriteLine("TestMockReturned, Post:" + RuntimeHelpers.GetHashCode(InternalLoggerFactory.DefaultFactory));
4758
}
4859

49-
static IDisposable SetupMockLogger(out Mock<ILogger> loggerMock)
60+
IDisposable SetupMockLogger(out Mock<ILogger> loggerMock)
5061
{
5162
ILoggerFactory oldLoggerFactory = InternalLoggerFactory.DefaultFactory;
63+
Output.WriteLine($"SetupMockLogger,oldLoggerFactory={RuntimeHelpers.GetHashCode(oldLoggerFactory)}");
5264
var loggerFactory = new LoggerFactory();
65+
Output.WriteLine($"SetupMockLogger,loggerFactory={RuntimeHelpers.GetHashCode(loggerFactory)}");
5366
var factoryMock = new Mock<ILoggerProvider>(MockBehavior.Strict);
5467
ILoggerProvider mockFactory = factoryMock.Object;
5568
loggerMock = new Mock<ILogger>(MockBehavior.Strict);
5669
loggerFactory.AddProvider(mockFactory);
5770
factoryMock.Setup(x => x.CreateLogger("mock")).Returns(loggerMock.Object);
5871
InternalLoggerFactory.DefaultFactory = loggerFactory;
59-
return new Disposable(() => InternalLoggerFactory.DefaultFactory = oldLoggerFactory);
72+
return new Disposable(() => {
73+
InternalLoggerFactory.DefaultFactory = oldLoggerFactory;
74+
Output.WriteLine($"SetupMockLogger,Dispose to={RuntimeHelpers.GetHashCode(oldLoggerFactory)}");
75+
});
6076
}
6177
}
6278
}

test/DotNetty.Common.Tests/Utilities/HashedWheelTimerTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public void TestScheduleTimeoutShouldRunAfterDelay()
5454
[Fact] // (timeout = 3000)
5555
public void TestStopTimer()
5656
{
57+
Output.WriteLine($"{System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(DotNetty.Common.Internal.Logging.InternalLoggerFactory.DefaultFactory)}");
5758
var latch = new CountdownEvent(3);
5859
ITimer timerProcessed = new HashedWheelTimer();
5960
for (int i = 0; i < 3; i++)

0 commit comments

Comments
 (0)