Skip to content

Commit c3a4c9f

Browse files
authored
Unit test display name issue fixed. (#795)
Fixes #793 Partially reverts changes introduced in #766
1 parent 5dafe82 commit c3a4c9f

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/Adapter/MSTest.CoreAdapter/ObjectModel/UnitTestElement.cs

+11-6
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,11 @@ public UnitTestElement(TestMethod testMethod)
109109
/// <returns> An instance of <see cref="TestCase"/>. </returns>
110110
internal TestCase ToTestCase()
111111
{
112-
string fullName = this.TestMethod.HasManagedMethodAndTypeProperties
113-
? string.Format(CultureInfo.InvariantCulture, "{0}.{1}", this.TestMethod.ManagedTypeName, this.TestMethod.ManagedMethodName)
114-
: string.Format(CultureInfo.InvariantCulture, "{0}.{1}", this.TestMethod.FullClassName, this.TestMethod.Name);
112+
// This causes compatibility problems with older runners.
113+
// string fullName = this.TestMethod.HasManagedMethodAndTypeProperties
114+
// ? string.Format(CultureInfo.InvariantCulture, "{0}.{1}", this.TestMethod.ManagedTypeName, this.TestMethod.ManagedMethodName)
115+
// : string.Format(CultureInfo.InvariantCulture, "{0}.{1}", this.TestMethod.FullClassName, this.TestMethod.Name);
116+
var fullName = string.Format(CultureInfo.InvariantCulture, "{0}.{1}", this.TestMethod.FullClassName, this.TestMethod.Name);
115117

116118
TestCase testCase = new TestCase(fullName, TestAdapter.Constants.ExecutorUri, this.TestMethod.AssemblyName);
117119
testCase.DisplayName = this.GetDisplayName();
@@ -195,9 +197,12 @@ private string GetDisplayName()
195197
{
196198
if (string.IsNullOrWhiteSpace(this.DisplayName))
197199
{
198-
return string.IsNullOrWhiteSpace(this.TestMethod.ManagedMethodName)
199-
? this.TestMethod.Name
200-
: this.TestMethod.ManagedMethodName;
200+
return this.TestMethod.Name;
201+
202+
// This causes compatibility problems with older runners.
203+
// return string.IsNullOrWhiteSpace(this.TestMethod.ManagedMethodName)
204+
// ? this.TestMethod.Name
205+
// : this.TestMethod.ManagedMethodName;
201206
}
202207
else
203208
{

0 commit comments

Comments
 (0)