Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix XmlException when writing Html log with certain test names #4576

Merged
merged 2 commits into from
Jun 28, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Revert "failed to make test"
This reverts commit d7766ee99830598a7537d9126d7d23949ed37fa4.
  • Loading branch information
danmoseley committed Jun 26, 2023
commit 4a37e81b3301cda7cb10bdcab53b825736074bac
Original file line number Diff line number Diff line change
Expand Up @@ -591,32 +591,6 @@ public void TestCompleteHandlerShouldNotDivideByZeroWhenThereAre0TestResults()
Assert.AreEqual(0, _htmlLogger.TestRunDetails.Summary.PassPercentage);
}

[TestMethod]
public void TestCompleteHandlerShouldHandleInvalidCharReferences()
{
System.Diagnostics.Debugger.Break();
VisualStudio.TestPlatform.Extensions.HtmlLogger.HtmlLogger hl = new(_mockFileHelper.Object, new Mock<IHtmlTransformer>().Object, new DataContractSerializer(typeof(TestRunDetails)));
hl.Initialize(_events.Object, _parameters);

MemoryStream xmlStream = new();
_mockFileHelper.Setup(x => x.GetStream(It.IsAny<string>(), FileMode.Open, FileAccess.Read)).Returns(xmlStream);
_mockFileHelper.Setup(x => x.Exists(It.IsAny<string>())).Returns(false);

MemoryStream htmlStream = new();
_mockFileHelper.Setup(x => x.GetStream(It.IsAny<string>(), FileMode.OpenOrCreate, FileAccess.ReadWrite)).Returns(htmlStream);
_mockFileHelper.Setup(x => x.Exists(It.IsAny<string>())).Returns(false);

var testCase = new TestCase("TestName", new Uri("some://uri"), "TestSource");
var testResult = new ObjectModel.TestResult(testCase) { Outcome = TestOutcome.Failed };
testResult.Messages.Add(new(TestResultMessage.StandardErrorCategory, "\uFFFF"));

hl.TestResultHandler(new object(), new TestResultEventArgs(testResult));

hl.TestRunCompleteHandler(new object(), new TestRunCompleteEventArgs(null, false, true, null, null, null, TimeSpan.Zero));

//Assert.AreEqual(htmlFileContent, new StreamReader(htmlStream).ReadToEnd());
}

private static TestCase CreateTestCase(string testCaseName)
{
return new TestCase(testCaseName, new Uri("some://uri"), "DummySourceFileName");
Expand Down