-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add logging for tests and try a fix.
- Loading branch information
1 parent
6d1dea8
commit 4f9ff61
Showing
13 changed files
with
59 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
global using Xunit; | ||
|
||
using NullGC.TestCommons; | ||
using Xunit.Extensions.Ordering; | ||
|
||
//[assembly: AssemblyFixture(typeof(DefaultAllocatorContextFixture))] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System.Reflection; | ||
using Xunit.Abstractions; | ||
|
||
namespace NullGC.TestCommons.Extensions; | ||
|
||
public static class XUnitExtensions | ||
{ | ||
public static bool TryGetITest(this ITestOutputHelper o, out ITest test) | ||
{ | ||
var type = o.GetType(); | ||
var testMember = type.GetField("test", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetProperty); | ||
test = (ITest) testMember?.GetValue(o)!; | ||
return test is not null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using NullGC.TestCommons.Extensions; | ||
using Xunit.Abstractions; | ||
|
||
namespace NullGC.TestCommons; | ||
|
||
public abstract class TestBase : IDisposable | ||
{ | ||
private readonly ITestOutputHelper _logger; | ||
|
||
protected TestBase(ITestOutputHelper logger) | ||
{ | ||
_logger = logger; | ||
if (logger.TryGetITest(out var test)) logger.WriteLine($"Starting test '{test.DisplayName}'"); | ||
else throw new InvalidOperationException(); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
if (_logger.TryGetITest(out var test)) _logger.WriteLine($"Finished test '{test.DisplayName}'"); | ||
else throw new InvalidOperationException(); | ||
} | ||
} |