コード例 #1
0
ファイル: AuditLogEntryTests.cs プロジェクト: devoctomy/cachy
        public void ToAndFromJSON()
        {
            String name = String.Empty;
            String type = String.Empty;

            AuditLogEntry.EntryType entryType = AuditLogEntry.EntryType.None;

            AuditLogEntry random = CreateRandomAuditLogEntry(_rng,
                                                             out name,
                                                             out type,
                                                             out entryType);

            DateTime dateTime = random.DateTime;

            ISerialiser   auditLogEntrySerialiser = FormatVersions.Instance.GetSerialiser(devoctomy.cachy.Framework.Serialisers.JSON.Common.LATEST_VAULT_VERSION, typeof(AuditLogEntry));
            JObject       json     = (JObject)auditLogEntrySerialiser.Write(random, String.Empty);
            AuditLogEntry fromJSON = (AuditLogEntry)auditLogEntrySerialiser.Read(json, String.Empty);

            Assert.IsTrue(random.CompareTo(fromJSON) == 0);
        }