|
10 | 10 | using Coverlet.Tests.Utils;
|
11 | 11 | using Newtonsoft.Json;
|
12 | 12 | using Xunit;
|
13 |
| -using Xunit.Sdk; |
14 | 13 |
|
15 | 14 | namespace Coverlet.Integration.Tests
|
16 | 15 | {
|
@@ -88,8 +87,8 @@ private protected void AssertCoverage(string standardOutput = "", bool checkDete
|
88 | 87 | [Fact]
|
89 | 88 | public void Msbuild()
|
90 | 89 | {
|
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"; |
93 | 92 | CreateDeterministicTestPropsFile();
|
94 | 93 |
|
95 | 94 | DotnetCli($"build -c {_buildConfiguration} -bl:build.{logFilename} /p:DeterministicSourcePaths=true", out string standardOutput, out string standardError, _testProjectPath);
|
@@ -131,8 +130,8 @@ public void Msbuild()
|
131 | 130 | [Fact]
|
132 | 131 | public void Msbuild_SourceLink()
|
133 | 132 | {
|
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"; |
136 | 135 | CreateDeterministicTestPropsFile();
|
137 | 136 |
|
138 | 137 | 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()
|
176 | 175 | [Fact]
|
177 | 176 | public void Collectors()
|
178 | 177 | {
|
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"; |
182 | 181 |
|
183 | 182 | CreateDeterministicTestPropsFile();
|
184 | 183 | DeleteLogFiles(testLogFilesPath);
|
@@ -231,9 +230,9 @@ public void Collectors()
|
231 | 230 | [Fact]
|
232 | 231 | public void Collectors_SourceLink()
|
233 | 232 | {
|
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"; |
237 | 236 |
|
238 | 237 | CreateDeterministicTestPropsFile();
|
239 | 238 | DeleteLogFiles(testLogFilesPath);
|
|
0 commit comments