Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions src/DemaConsulting.TestResults/IO/TrxSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ private static Dictionary<string, XElement> BuildTestMethodLookup(XDocument doc)
/// <returns>A TestResult object populated with data from the XML element</returns>
private static TestResult ParseTestResult(
XElement resultElement,
IReadOnlyDictionary<string, XElement> testMethodsById)
Dictionary<string, XElement> testMethodsById)
{
var testId = resultElement.Attribute("testId") ??
throw new InvalidOperationException(InvalidTrxFileMessage);
Expand Down Expand Up @@ -498,7 +498,7 @@ private static TestOutcome ParseTestOutcome(string? value)
// Try to parse the raw string into a TestOutcome enum member.
// Only accept the result when it is a defined, named member of the enum.
if (Enum.TryParse<TestOutcome>(value, ignoreCase: true, out var outcome) &&
Enum.IsDefined(typeof(TestOutcome), outcome))
Enum.IsDefined<TestOutcome>(outcome))
{
return outcome;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ public void TrxSerializer_Serialize_ThenDeserialize_PreservesTestData()
Assert.AreEqual("BuildAgent01", passed.ComputerName);
Assert.AreEqual(TestOutcome.Passed, passed.Outcome);
Assert.AreEqual(startTime, passed.StartTime);
Assert.IsTrue(Math.Abs((passed.Duration - TimeSpan.FromSeconds(1.5)).TotalSeconds) < 0.001);
Assert.IsLessThan(0.001, Math.Abs((passed.Duration - TimeSpan.FromSeconds(1.5)).TotalSeconds));
Assert.AreEqual("All good", passed.SystemOutput);
Assert.AreEqual(string.Empty, passed.SystemError);
Assert.AreEqual(string.Empty, passed.ErrorMessage);
Expand All @@ -547,7 +547,7 @@ public void TrxSerializer_Serialize_ThenDeserialize_PreservesTestData()
Assert.AreEqual("BuildAgent01", failed.ComputerName);
Assert.AreEqual(TestOutcome.Failed, failed.Outcome);
Assert.AreEqual(startTime.AddSeconds(2), failed.StartTime);
Assert.IsTrue(Math.Abs((failed.Duration - TimeSpan.FromSeconds(0.75)).TotalSeconds) < 0.001);
Assert.IsLessThan(0.001, Math.Abs((failed.Duration - TimeSpan.FromSeconds(0.75)).TotalSeconds));
Assert.AreEqual(string.Empty, failed.SystemOutput);
Assert.AreEqual("err output", failed.SystemError);
Assert.AreEqual("Expected 1 but was 2", failed.ErrorMessage);
Expand All @@ -559,7 +559,7 @@ public void TrxSerializer_Serialize_ThenDeserialize_PreservesTestData()
Assert.AreEqual("Suite.ErrorClass", error.ClassName);
Assert.AreEqual(TestOutcome.Error, error.Outcome);
Assert.AreEqual(startTime.AddSeconds(4), error.StartTime);
Assert.IsTrue(Math.Abs((error.Duration - TimeSpan.FromSeconds(0.25)).TotalSeconds) < 0.001);
Assert.IsLessThan(0.001, Math.Abs((error.Duration - TimeSpan.FromSeconds(0.25)).TotalSeconds));
Assert.AreEqual("NullReferenceException", error.ErrorMessage);
Assert.AreEqual("at Suite.ErrorClass.ErrorTest() line 17", error.ErrorStackTrace);

Expand All @@ -569,7 +569,7 @@ public void TrxSerializer_Serialize_ThenDeserialize_PreservesTestData()
Assert.AreEqual("Suite.SkippedClass", skipped.ClassName);
Assert.AreEqual(TestOutcome.NotExecuted, skipped.Outcome);
Assert.AreEqual(startTime.AddSeconds(6), skipped.StartTime);
Assert.IsTrue(Math.Abs(skipped.Duration.TotalSeconds) < 0.001);
Assert.IsLessThan(0.001, Math.Abs(skipped.Duration.TotalSeconds));
}

/// <summary>
Expand Down
Loading