Beispiel #1
0
        public void Object_JsonConverters_Class()
        {
            var x = new SampleModel()
            {
                Title = "Cool Object",
                Age   = 23,
                Type  = ModelType.Sample
            };

            const string expected = "{\"Title\":\"Cool Object\",\"Age\":23,\"Type\":\"Sample\"}";

            MakeSure.That(x.ToJSON()).Is(expected);

            var json = expected.FromJSON <SampleModel>();

            MakeSure.That(json.Title).Is(x.Title);
        }