From 54932a719933c71a111fa8d6a5274e9f8967c8a4 Mon Sep 17 00:00:00 2001 From: June Rhodes Date: Sun, 26 Dec 2021 18:10:05 +1100 Subject: [PATCH] Include [Theory] parameters in test names This fixes https://github.com/spekt/junit.testlogger/issues/50 by including the Xunit theory parameters in test names. --- src/TestLogger/Extensions/XunitTestAdapter.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/TestLogger/Extensions/XunitTestAdapter.cs b/src/TestLogger/Extensions/XunitTestAdapter.cs index 6fcc013..c206ac4 100644 --- a/src/TestLogger/Extensions/XunitTestAdapter.cs +++ b/src/TestLogger/Extensions/XunitTestAdapter.cs @@ -46,6 +46,14 @@ public List TransformResults( result.Messages.Add(new TestResultMessage("skipReason", skipReason)); } + string displayName = result.Result.DisplayName; + + // Add parameters for theories. + if (displayName.Contains("(")) + { + result.Method += displayName.Substring(displayName.IndexOf("(")); + } + transformedResults.Add(result); }