Skip to content

Commit 902376b

Browse files
committed
fix log file names using xunit.v3
1 parent 3e31c5f commit 902376b

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

test/coverlet.integration.tests/DeterministicBuild.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
using Coverlet.Tests.Utils;
1111
using Newtonsoft.Json;
1212
using Xunit;
13-
using Xunit.Sdk;
1413

1514
namespace Coverlet.Integration.Tests
1615
{
@@ -88,8 +87,8 @@ private protected void AssertCoverage(string standardOutput = "", bool checkDete
8887
[Fact]
8988
public void Msbuild()
9089
{
91-
string testResultPath = Path.Join(_testResultsPath, ((ITest)_testMember!.GetValue(_output)!).TestDisplayName);
92-
string logFilename = string.Concat(((ITest)_testMember!.GetValue(_output)!).TestDisplayName, ".binlog");
90+
string testResultPath = Path.Join(_testResultsPath, $"{TestContext.Current.TestClass?.TestClassName}.{TestContext.Current.TestMethod?.MethodName}");
91+
string logFilename = $"{TestContext.Current.TestClass?.TestClassName}.{TestContext.Current.TestMethod?.MethodName}.binlog";
9392
CreateDeterministicTestPropsFile();
9493

9594
DotnetCli($"build -c {_buildConfiguration} -bl:build.{logFilename} /p:DeterministicSourcePaths=true", out string standardOutput, out string standardError, _testProjectPath);
@@ -131,8 +130,8 @@ public void Msbuild()
131130
[Fact]
132131
public void Msbuild_SourceLink()
133132
{
134-
string testResultPath = Path.Join(_testResultsPath, ((ITest)_testMember!.GetValue(_output)!).TestDisplayName);
135-
string logFilename = string.Concat(((ITest)_testMember!.GetValue(_output)!).TestDisplayName, ".binlog");
133+
string testResultPath = Path.Join(_testResultsPath, $"{TestContext.Current.TestClass?.TestClassName}.{TestContext.Current.TestMethod?.MethodName}");
134+
string logFilename = $"{TestContext.Current.TestClass?.TestClassName}.{TestContext.Current.TestMethod?.MethodName}.binlog";
136135
CreateDeterministicTestPropsFile();
137136

138137
DotnetCli($"build -c {_buildConfiguration} -bl:build.{logFilename} --verbosity normal /p:DeterministicSourcePaths=true", out string standardOutput, out string standardError, _testProjectPath);
@@ -176,9 +175,9 @@ public void Msbuild_SourceLink()
176175
[Fact]
177176
public void Collectors()
178177
{
179-
string testResultPath = Path.Join(_testResultsPath, ((ITest)_testMember!.GetValue(_output)!).TestDisplayName);
180-
string testLogFilesPath = Path.Join(_testResultsPath, ((ITest)_testMember!.GetValue(_output)!).TestDisplayName, "log");
181-
string logFilename = string.Concat(((ITest)_testMember!.GetValue(_output)!).TestDisplayName, ".binlog");
178+
string testResultPath = Path.Join(_testResultsPath, $"{TestContext.Current.TestClass?.TestClassName}.{TestContext.Current.TestMethod?.MethodName}");
179+
string testLogFilesPath = Path.Join(_testResultsPath, $"{TestContext.Current.TestClass?.TestClassName}.{TestContext.Current.TestMethod?.MethodName}", "log");
180+
string logFilename = $"{TestContext.Current.TestClass?.TestClassName}.{TestContext.Current.TestMethod?.MethodName}.binlog";
182181

183182
CreateDeterministicTestPropsFile();
184183
DeleteLogFiles(testLogFilesPath);
@@ -231,9 +230,9 @@ public void Collectors()
231230
[Fact]
232231
public void Collectors_SourceLink()
233232
{
234-
string testResultPath = Path.Join(_testResultsPath, ((ITest)_testMember!.GetValue(_output)!).TestDisplayName);
235-
string testLogFilesPath = Path.Join(_testResultsPath, ((ITest)_testMember!.GetValue(_output)!).TestDisplayName, "log");
236-
string logFilename = string.Concat(((ITest)_testMember!.GetValue(_output)!).TestDisplayName, ".binlog");
233+
string testResultPath = Path.Join(_testResultsPath, $"{TestContext.Current.TestClass?.TestClassName}.{TestContext.Current.TestMethod?.MethodName}");
234+
string testLogFilesPath = Path.Join(_testResultsPath, $"{TestContext.Current.TestClass?.TestClassName}.{TestContext.Current.TestMethod?.MethodName}", "log");
235+
string logFilename = $"{TestContext.Current.TestClass?.TestClassName}.{TestContext.Current.TestMethod?.MethodName}.binlog";
237236

238237
CreateDeterministicTestPropsFile();
239238
DeleteLogFiles(testLogFilesPath);

0 commit comments

Comments
 (0)