public void Parse() { // Arrange string xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><test-run id=\"2\" duration=\"2.9130068999999832\" testcasecount=\"150\" total=\"6\" passed=\"3\" failed=\"2\" skipped=\"1\" result=\"Failed\" start-time=\"2018-08-10T 13:16:57Z\" end-time=\"2018-08-10T 13:17:02Z\"></test-run>"; // Act TestRun testRun = NUnitTestResultsParser.Parse(XDocument.Parse(xml)); // Assert AssertTestRun(testRun, 6, 3, 2, 1, "Failed", false, "2"); }
public void ParseXml() { // Arrange string path = XmlPathUtility.GetTestXmlPath("Organon.ExceptionHandling.AspNetCore.Tests.unittest.xml"); NUnitTestResultsParser testResultsParser = new NUnitTestResultsParser(); // Act TestRun testRun = testResultsParser.ParseXml(path); // Assert AssertTestRun(testRun, 9, 8, 1, 0, "Failed", false, "2"); }
public void Parse_ShouldThrowArgumentNull_WhenXDocumentIsNull() { // Arrange - Act ArgumentNullException argumentNullException = Assert.Throws <ArgumentNullException>(() => NUnitTestResultsParser.Parse(null)); // Assert Assert.AreEqual($"Value cannot be null.{Environment.NewLine}Parameter name: xmlDocument", argumentNullException.Message); }