Beispiel #1
0
        public void TestSerializerOrderMetadataProperty()
        {
            var originalModelJson = TestHelper.GetInputFileContent(testsSubpath, "TestSerializerOrderMetadataProperty", "SerializerTesting-entity.json");
            var deserialized      = Deserialize <Entity>(originalModelJson);
            var serialized        = Serialize(deserialized);

            if (doesWriteTestDebuggingFiles)
            {
                TestHelper.WriteActualOutputFileContent(testsSubpath, "TestSerializerOrderMetadataProperty", "SerializerTesting -entity.json", serialized);
            }

            TestHelper.AssertSameObjectWasSerialized(originalModelJson, serialized);
            originalModelJson.Replace("\r\n", "\n");
            serialized.Replace("\r\n", "\n");
            // "$type" appears on same position.
            Assert.AreEqual(originalModelJson.IndexOf('$'), serialized.IndexOf('$'));
        }
Beispiel #2
0
        public void TestEntityTimeDateReadInLocalFormat()
        {
            var originalModelJson = TestHelper.GetInputFileContent(testsSubpath, "TestEntityTimeDateReadInLocalFormat", "SerializerTesting-entity2.json");
            var deserialized      = Deserialize <Entity>(originalModelJson);

            var expectedSerializedLastChildFileModifiedTime = "\"2018-12-19T02:05:03.2374986+00:00\"";
            var expectedSerializedLastFileModifiedTime      = "\"2018-12-19T05:05:03.2374986+00:00\"";
            var expectedSerializedLastFileStatusCheckTime   = "\"2018-12-19T21:35:03.2374986+00:00\"";

            var lastChildFileModifiedTime = deserialized?.LastChildFileModifiedTime;
            var lastFileModifiedTime      = deserialized?.LastFileModifiedTime;
            var lastFileStatusCheckTime   = deserialized?.LastFileStatusCheckTime;

            Assert.AreEqual(expectedSerializedLastChildFileModifiedTime, Serialize(lastChildFileModifiedTime));
            Assert.AreEqual(expectedSerializedLastFileModifiedTime, Serialize(lastFileModifiedTime));
            Assert.AreEqual(expectedSerializedLastFileStatusCheckTime, Serialize(lastFileStatusCheckTime));


            string serialized = Serialize(deserialized);

            Assert.IsTrue(serialized.Contains(expectedSerializedLastChildFileModifiedTime));
            Assert.IsTrue(serialized.Contains(expectedSerializedLastFileModifiedTime));
            Assert.IsTrue(serialized.Contains(expectedSerializedLastFileStatusCheckTime));
        }