private static NativeWorkItem MapFromJtoken(JToken jtoken)
        {
            var nativeWorkItem = new NativeWorkItem
            {
                Relations = new List <NativeWorkItemRelation>(),
                Fields    = new List <NativeWorkItemField>(),
                Id        = jtoken["id"].Value <int>(),
                Rev       = jtoken["rev"].Value <long>(),
                Url       = jtoken["url"].Value <string>()
            };

            var fields    = jtoken["fields"].ToObject <Dictionary <string, object> >();
            var relations = (JArray)jtoken["relations"];

            foreach (var field in fields)
            {
                var nativeField = new NativeWorkItemField
                {
                    Namespace = field.Key,
                    Value     = field.Value
                };
                nativeWorkItem.Fields.Add(nativeField);
            }

            if (relations != null)
            {
                foreach (var rel in relations)
                {
                    var relationDto = new NativeWorkItemRelation
                    {
                        Rel = rel["rel"].Value <string>(),
                        Url = rel["url"].Value <string>()
                    };

                    nativeWorkItem.Relations.Add(relationDto);
                }
            }

            return(nativeWorkItem);
        }
 public NativeWorkItemInformation(NativeWorkItem workItem)
 {
     this.workItem = workItem;
 }
 private WorkItem Adapt(NativeWorkItem nativeWorkItem)
 {
     return(_adapterResolver
            .ResolveByAdapteeTypes <NativeWorkItem, WorkItem>()
            .Adapt(nativeWorkItem));
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="NativeWorkItemAdapter" /> class.
 /// </summary>
 /// <param name="converter">The converter.</param>
 /// <param name="nativeWorkItem">The native work item.</param>
 /// <exception cref="ArgumentNullException">nativeWorkItem</exception>
 /// <inheritdoc />
 public NativeWorkItemAdapter(IConverter converter, NativeWorkItem nativeWorkItem) : base(converter)
 {
     NativeWorkItem = nativeWorkItem ?? throw new ArgumentNullException(nameof(nativeWorkItem));
     Callback       = NativeWorkItem.Callback;
     Data           = NativeWorkItem.Data;
 }