public IEnumerator TestReportSerialization_ValidReport_ReportsAreTheSame() { var report = new BacktraceReport(new Exception("test")); var json = report.ToJson(); var deserializedReport = BacktraceReport.Deserialize(json); Assert.IsTrue(deserializedReport.Uuid == report.Uuid); Assert.IsTrue(deserializedReport.Classifier == report.Classifier); Assert.IsTrue(deserializedReport.Message == report.Message); Assert.IsTrue(deserializedReport.Timestamp == report.Timestamp); Assert.IsTrue(deserializedReport.DiagnosticStack.Count == report.DiagnosticStack.Count); Assert.IsTrue(deserializedReport.Fingerprint == report.Fingerprint); Assert.IsTrue(deserializedReport.Factor == report.Factor); Assert.IsTrue(deserializedReport.ExceptionTypeReport == report.ExceptionTypeReport); Assert.IsTrue(deserializedReport.Attributes.Count == report.Attributes.Count); Assert.IsTrue(deserializedReport.AttachmentPaths.Count == report.AttachmentPaths.Count); yield return(null); }
private IEnumerator TestSerialization(BacktraceReport report) { var json = report.ToJson(); var deserializedReport = BacktraceReport.Deserialize(json); foreach (var attribute in deserializedReport.Attributes) { // ignore validating types - tests already validating it. // here we want to be sure that we correctly assigned json data var attributeValue = reportAttributes[attribute.Key].ToString(); Assert.AreEqual(attributeValue, attribute.Value); } Assert.IsTrue(attachemnts.SequenceEqual(deserializedReport.AttachmentPaths)); Assert.AreEqual(report.Classifier, deserializedReport.Classifier); Assert.AreEqual(report.DiagnosticStack.Count, deserializedReport.DiagnosticStack.Count); Assert.AreEqual(report.Message, deserializedReport.Message); yield return(null); }