public void SerializationSerialize()
        {
            var job = new TestSerializationJob()
            {
                A = new Guid("1854ef1b-3937-476a-8b32-56436a7b6feb").ToString(),
                B = "Hello, world!",
                C = new DateTime(1982, 5, 28).ToUniversalTime()
            };

            string data = JobSerializer.Serialize(job);
            Assert.AreEqual(@"{""A"":""1854ef1b-3937-476a-8b32-56436a7b6feb"",""B"":""Hello, world!"",""C"":""1982-05-28T07:00:00Z""}", data);
        }
Example #2
0
        public void SerializationSerialize()
        {
            var job = new TestSerializationJob()
            {
                A = new Guid("1854ef1b-3937-476a-8b32-56436a7b6feb").ToString(),
                B = "Hello, world!",
                C = new DateTime(1982, 5, 28).ToUniversalTime()
            };

            string data = JobSerializer.Serialize(job);

            Assert.AreEqual(@"{""A"":""1854ef1b-3937-476a-8b32-56436a7b6feb"",""B"":""Hello, world!"",""C"":""1982-05-28T07:00:00Z""}", data);
        }
Example #3
0
        public void SerializationDeserialize()
        {
            string typeName          = JobSerializer.GetTypeName(typeof(TestSerializationJob));
            string data              = @"{""A"":""1854ef1b-3937-476a-8b32-56436a7b6feb"",""B"":""Hello, world!"",""C"":""1982-05-28T07:00:00Z""}";
            TestSerializationJob job = JobSerializer.Deserialize(typeName, data) as TestSerializationJob;

            Assert.IsNotNull(job);
            Assert.AreEqual("1854ef1b-3937-476a-8b32-56436a7b6feb", job.A);
            Assert.AreEqual("Hello, world!", job.B);
            Assert.AreEqual(new DateTime(1982, 5, 28).ToUniversalTime(), job.C);

            Assert.IsNotNull(JobSerializer.Deserialize(typeName, null));
        }