Skip to content

Commit

Permalink
Fix conflict and fix broken behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
Evangelink committed Jun 1, 2022
1 parent 547287e commit 027377b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
1 change: 1 addition & 0 deletions TestPlatform.sln
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,7 @@ Global
src\Microsoft.TestPlatform.Execution.Shared\Microsoft.TestPlatform.Execution.Shared.projitems*{186069fe-e1e8-4de1-bea4-0ff1484d22d1}*SharedItemsImports = 5
src\Microsoft.TestPlatform.Execution.Shared\Microsoft.TestPlatform.Execution.Shared.projitems*{27dfbd04-64b2-4f1b-82b2-006620cca6f8}*SharedItemsImports = 5
src\Microsoft.TestPlatform.Execution.Shared\Microsoft.TestPlatform.Execution.Shared.projitems*{2c7ce1f8-e73e-4987-8023-b5a0ebac86e8}*SharedItemsImports = 5
src\Microsoft.TestPlatform.Nullability\Microsoft.TestPlatform.Nullability.projitems*{61f7f446-9ef3-4768-b33a-4d75f60e1059}*SharedItemsImports = 5
src\Microsoft.TestPlatform.Nullability\Microsoft.TestPlatform.Nullability.projitems*{65a25d6e-c9cc-4f45-8925-04087ac82634}*SharedItemsImports = 5
src\Microsoft.TestPlatform.Nullability\Microsoft.TestPlatform.Nullability.projitems*{68adc720-316e-4895-9f8e-c3ccadd262be}*SharedItemsImports = 5
src\Microsoft.TestPlatform.Execution.Shared\Microsoft.TestPlatform.Execution.Shared.projitems*{71cb42ff-e750-4a3b-9c3a-ac938853cc89}*SharedItemsImports = 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TestPlatformRoot Condition="$(TestPlatformRoot) == ''">..\..\</TestPlatformRoot>
</PropertyGroup>
<Import Project="..\Microsoft.TestPlatform.Nullability\Microsoft.TestPlatform.Nullability.projitems" Label="Shared" />
<Import Project="$(TestPlatformRoot)scripts/build/TestPlatform.Settings.targets" />
<PropertyGroup>
<AssemblyName>Microsoft.TestPlatform.Utilities</AssemblyName>
Expand Down Expand Up @@ -47,10 +48,5 @@
<AdditionalFiles Include="PublicAPI/$(TargetFramework)/PublicAPI.Shipped.txt" />
<AdditionalFiles Include="PublicAPI/$(TargetFramework)/PublicAPI.Unshipped.txt" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\NullableAttributes.cs" Link="NullableAttributes.cs" />
<Compile Include="..\..\StringUtils.cs" Link="StringUtils.cs" />
<Compile Include="..\..\TPDebug.cs" Link="TPDebug.cs" />
</ItemGroup>
<Import Project="$(TestPlatformRoot)scripts\build\TestPlatform.targets" />
</Project>
4 changes: 2 additions & 2 deletions src/Microsoft.TestPlatform.Utilities/XmlUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ internal class XmlUtilities
/// <param name="runSettingsNavigator"> The xml navigator. </param>
/// <param name="nodeXPath"> The xPath of the node. </param>
/// <returns></returns>
internal static string? GetNodeXml(XPathNavigator? runSettingsNavigator, string nodeXPath)
internal static string? GetNodeXml(XPathNavigator runSettingsNavigator, string nodeXPath)
{
var node = runSettingsNavigator?.SelectSingleNode(nodeXPath);
var node = runSettingsNavigator.SelectSingleNode(nodeXPath);
return node?.InnerXml;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.Utilities;

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Microsoft.TestPlatform.Utilities.UnitTests;
Expand All @@ -29,7 +28,7 @@ public void GetNodeXmlShouldThrowIfXPathIsNull()
var settingsXml = @"<RunSettings></RunSettings>";
var xmlDocument = GetXmlDocument(settingsXml);

Assert.ThrowsException<XPathException>(() => XmlUtilities.GetNodeXml(xmlDocument.CreateNavigator(), null!));
Assert.ThrowsException<XPathException>(() => XmlUtilities.GetNodeXml(xmlDocument.CreateNavigator()!, null!));
}

[TestMethod]
Expand All @@ -38,7 +37,7 @@ public void GetNodeXmlShouldThrowIfXPathIsInvalid()
var settingsXml = @"<RunSettings></RunSettings>";
var xmlDocument = GetXmlDocument(settingsXml);

Assert.ThrowsException<XPathException>(() => XmlUtilities.GetNodeXml(xmlDocument.CreateNavigator(), @"Rs\r"));
Assert.ThrowsException<XPathException>(() => XmlUtilities.GetNodeXml(xmlDocument.CreateNavigator()!, @"Rs\r"));
}

[TestMethod]
Expand All @@ -47,7 +46,7 @@ public void GetNodeXmlShouldReturnNullIfNodeDoesNotExist()
var settingsXml = @"<RunSettings></RunSettings>";
var xmlDocument = GetXmlDocument(settingsXml);

Assert.IsNull(XmlUtilities.GetNodeXml(xmlDocument.CreateNavigator(), @"/RunSettings/RunConfiguration"));
Assert.IsNull(XmlUtilities.GetNodeXml(xmlDocument.CreateNavigator()!, @"/RunSettings/RunConfiguration"));
}

[TestMethod]
Expand All @@ -56,7 +55,7 @@ public void GetNodeXmlShouldReturnNodeValue()
var settingsXml = @"<RunSettings><RC>abc</RC></RunSettings>";
var xmlDocument = GetXmlDocument(settingsXml);

Assert.AreEqual("abc", XmlUtilities.GetNodeXml(xmlDocument.CreateNavigator(), @"/RunSettings/RC"));
Assert.AreEqual("abc", XmlUtilities.GetNodeXml(xmlDocument.CreateNavigator()!, @"/RunSettings/RC"));
}

#endregion
Expand Down

0 comments on commit 027377b

Please sign in to comment.