I've been setting up a Cake script (C# Make) in preparation of automating our unit testing. I have the script set up and it's running the unit tests as expected except for one quirk...
One of the simpler tests is failing when MSTest attempts to execute it but it passes with flying colors when I run the test from VS 2013.
[TestMethod]
public void Field_is_XmlNode_innertext_urlencode()
{
// Arrange
var xmlDoc = new XmlDocument();
xmlDoc.LoadXml("<field>\"'#</field>");
var fetchedField = xmlDoc.SelectSingleNode("field");
// Assert
Assert.AreEqual("%22%27%23", CrmHelpers.GetFetchedFieldValueAsString(fetchedField, null, true));
}
Cake script section that calls MSTest.
Task("RunTests")
.IsDependentOn("Build")
.Does(() =>
{
Information("TestPath {0}", "./Tests/Unit Tests/**/bin/" + configuration + "/*.UnitTests.dll");
MSTest("./Tests/Unit Tests/**/bin/" + configuration + "/*.UnitTests.dll");
});
In VS2013 the value \"'# is properly encoded to %22%27%23 however when executing the test via Cake calling MSTest that same value is encoded as %22'%23.
My questions are: Why are these values encoded differently in MSTest from what I see in VS2013 when theoretically it should be running the same code? How do I correct the issue so that MSTest runs all of my unit tests in a predictable and consistent manner?
Aucun commentaire:
Enregistrer un commentaire