From fbfbb9050e2715a193afe32bd56ca3a103106f19 Mon Sep 17 00:00:00 2001 From: Thomas Broust Date: Fri, 19 Sep 2014 16:36:07 +0200 Subject: [PATCH] Fixes a bug with the name of the test cases containing a dot in the parameters --- NUnit HTML Report Generator/ExampleResults.xml | 4 ++-- NUnit HTML Report Generator/Program.cs | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/NUnit HTML Report Generator/ExampleResults.xml b/NUnit HTML Report Generator/ExampleResults.xml index d29c796..5e605bb 100644 --- a/NUnit HTML Report Generator/ExampleResults.xml +++ b/NUnit HTML Report Generator/ExampleResults.xml @@ -30,8 +30,8 @@ - - + + diff --git a/NUnit HTML Report Generator/Program.cs b/NUnit HTML Report Generator/Program.cs index b6b474e..ab8a744 100644 --- a/NUnit HTML Report Generator/Program.cs +++ b/NUnit HTML Report Generator/Program.cs @@ -483,8 +483,18 @@ private static string GenerateFixtureModal(XElement fixture, string modalId, str name = testCase.Attribute("name").Value; result = testCase.Attribute("result").Value; - // Remove namespace if included - name = name.Substring(name.LastIndexOf('.') + 1, name.Length - name.LastIndexOf('.') - 1); + // Remove namespace if included, which is all text before the last point, the last point being before any parenthesis (for the test cases) + int parenthesisPosition = name.LastIndexOf('('); + if (parenthesisPosition >= 0) + { + parenthesisPosition = parenthesisPosition - 1; + } + else + { + parenthesisPosition = name.Length - 1; + } + + name = name.Substring(name.LastIndexOf('.', parenthesisPosition) + 1, name.Length - name.LastIndexOf('.', parenthesisPosition) - 1); html.AppendLine("