public IEnumerator TestAnnotations_ValidReport_AnnotationExists()
        {
            var report           = new BacktraceReport(new Exception("test"));
            var data             = new BacktraceData(report, null);
            var json             = data.Annotation.ToJson();
            var deserializedData = Annotations.Deserialize(json);

            Assert.IsTrue(deserializedData.EnvironmentVariables.Count == data.Annotation.EnvironmentVariables.Count);
            yield return(null);
        }
Esempio n. 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"])
            });
        }