internal virtual void MergeMagicFields(IDictionary <String, Object> data) { lock (this.mutex) { if (data.ContainsKey("objectId")) { this.ConversationId = (data["objectId"] as String); data.Remove("objectId"); } if (data.ContainsKey("createdAt")) { this.CreatedAt = AVDecoder.ParseDate(data["createdAt"] as string); data.Remove("createdAt"); } if (data.ContainsKey("updatedAt")) { this.updatedAt = AVDecoder.ParseDate(data["updatedAt"] as string); data.Remove("updatedAt"); } if (data.ContainsKey("name")) { this.Name = (data["name"] as String); data.Remove("name"); } if (data.ContainsKey("lm")) { this.LastMessageAt = AVDecoder.Instance.Decode(data["lm"]) as DateTime?; data.Remove("lm"); } if (data.ContainsKey("m")) { this.MemberIds = AVDecoder.Instance.DecodeList <string>(data["m"]); data.Remove("m"); } if (data.ContainsKey("mu")) { this.MuteMemberIds = AVDecoder.Instance.DecodeList <string>(data["mu"]); data.Remove("mu"); } if (data.ContainsKey("c")) { this.Creator = data["c"].ToString(); data.Remove("c"); } if (data.ContainsKey("unique")) { if (data["unique"] is bool) { this.IsUnique = (bool)data["unique"]; } data.Remove("unique"); } foreach (var kv in data) { this[kv.Key] = kv.Value; } } }
public void TestParseDate() { DateTime dateTime = (DateTime)AVDecoder.Instance.Decode(AVDecoder.ParseDate("1990-08-30T12:03:59.000Z")); dateTime = dateTime.ToUniversalTime(); Assert.AreEqual(1990, dateTime.Year); Assert.AreEqual(8, dateTime.Month); Assert.AreEqual(30, dateTime.Day); Assert.AreEqual(12, dateTime.Hour); Assert.AreEqual(3, dateTime.Minute); Assert.AreEqual(59, dateTime.Second); Assert.AreEqual(0, dateTime.Millisecond); }