public IEnumerator TestAttributes_ValidReport_AttributesExists()
        {
            var report           = new BacktraceReport(new Exception("test"));
            var data             = new BacktraceData(report, null);
            var json             = data.Attributes.ToJson();
            var deserializedData = BacktraceAttributes.Deserialize(json);

            Assert.IsTrue(deserializedData.Attributes.Count == data.Attributes.Attributes.Count);
            yield return(null);
        }
Beispiel #2
0
        /// <summary>
        /// Convert JSON to Backtrace Data
        /// </summary>
        /// <param name="json">Backtrace Data JSON</param>
        /// <returns>Backtrace Data instance</returns>
        public static BacktraceData Deserialize(string json)
        {
            var @object = BacktraceJObject.Parse(json);

            var classfiers = @object == null ? null : @object["classifiers"]
                             .Select(n => n.Value <string>()).ToArray() ?? null;

            return(new BacktraceData()
            {
                Uuid = new Guid(@object.Value <string>("uuid")),
                Timestamp = @object.Value <long>("timestamp"),
                MainThread = @object.Value <string>("mainThread"),
                Classifier = classfiers,
                Annotation = Annotations.Deserialize(@object["annotations"]),
                Attributes = BacktraceAttributes.Deserialize(@object["attributes"]),
                ThreadData = ThreadData.DeserializeThreadInformation(@object["threads"])
            });
        }