Merge pull request #39 from nunit/issue-35
Merge pull request #38 from nunit/updt-recipe
This commit is contained in:
Коммит
c56dd796d4
|
@ -79,7 +79,9 @@ namespace NUnit.Engine.Addins
|
|||
DateTime start = result.GetAttribute("start-time", DateTime.UtcNow);
|
||||
_xmlWriter.WriteAttributeString("date", start.ToString("yyyy-MM-dd"));
|
||||
_xmlWriter.WriteAttributeString("time", start.ToString("HH:mm:ss"));
|
||||
WriteEnvironment(assemblies[0].SelectSingleNode("environment")?.GetAttribute("framework-version"));
|
||||
|
||||
|
||||
WriteEnvironment(GetFrameworkVersion(assemblies));
|
||||
WriteCultureInfo();
|
||||
}
|
||||
|
||||
|
@ -93,6 +95,22 @@ namespace NUnit.Engine.Addins
|
|||
_xmlWriter.WriteEndElement();
|
||||
}
|
||||
|
||||
private string GetFrameworkVersion(XmlNodeList assemblies)
|
||||
{
|
||||
// The nunit2 format requires a framework-version attribute as part of the environment
|
||||
// element. This was an error in the original V2 design, since the various assemblies
|
||||
// do not necessarily use the same framework version. To provide some value, we examine
|
||||
// all the assemblies and return the first non-empty value found.
|
||||
foreach (XmlNode node in assemblies)
|
||||
{
|
||||
var version = node.SelectSingleNode("environment")?.GetAttribute("framework-version");
|
||||
if (!string.IsNullOrEmpty(version))
|
||||
return version;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
private void WriteEnvironment(string frameworkVersion)
|
||||
{
|
||||
_xmlWriter.WriteStartElement("environment");
|
||||
|
|
Загрузка…
Ссылка в новой задаче