Esempio n. 1
0
        public void TestDeserialize()
        {
            var serializer = new ScgApi.Serialize <Data>();
            var json       = @"{ ""id"":""idXXX"", ""application_id"":12345, ""first_name"":""John""}";

            var data = serializer.ToModel(json);

            Assert.Equal("idXXX", data.Id);
            Assert.Equal(12345, data.ApplicationId.Value);
            Assert.Equal("John", data.FirstName);
        }
Esempio n. 2
0
        public void TestSerialize()
        {
            var  serializer = new ScgApi.Serialize <Data>();
            Data data       = new Data("idXXX", 12345, "John");

            string json = serializer.ToJson(data);

            Assert.DoesNotContain("id", json);
            Assert.DoesNotContain("application_id", json);
            Assert.Contains("first_name", json);
        }