public void SpecifiedTest()
        {
            var c = new SpecifiedTestClass();
            c.Name = "James";
            c.Age = 27;
            c.NameSpecified = false;

            InMemoryTraceWriter traceWriter = new InMemoryTraceWriter
            {
                LevelFilter = TraceLevel.Verbose
            };

            string json = JsonConvert.SerializeObject(c, Formatting.Indented, new JsonSerializerSettings { TraceWriter = traceWriter });

            Assert.Equal("Started serializing OpenGamingLibrary.Json.Test.Serialization.SpecifiedTestClass. Path ''.", traceWriter.TraceRecords[0].Message);
            Assert.Equal("IsSpecified result for property 'Name' on OpenGamingLibrary.Json.Test.Serialization.SpecifiedTestClass: False. Path ''.", traceWriter.TraceRecords[1].Message);
            Assert.Equal("IsSpecified result for property 'Weight' on OpenGamingLibrary.Json.Test.Serialization.SpecifiedTestClass: False. Path 'Age'.", traceWriter.TraceRecords[2].Message);
            Assert.Equal("IsSpecified result for property 'Height' on OpenGamingLibrary.Json.Test.Serialization.SpecifiedTestClass: False. Path 'Age'.", traceWriter.TraceRecords[3].Message);
            Assert.Equal("IsSpecified result for property 'FavoriteNumber' on OpenGamingLibrary.Json.Test.Serialization.SpecifiedTestClass: False. Path 'Age'.", traceWriter.TraceRecords[4].Message);
            Assert.Equal("Finished serializing OpenGamingLibrary.Json.Test.Serialization.SpecifiedTestClass. Path ''.", traceWriter.TraceRecords[5].Message);

            StringAssert.Equal(@"{
  ""Age"": 27
}", json);

            traceWriter = new InMemoryTraceWriter
            {
                LevelFilter = TraceLevel.Verbose
            };

            SpecifiedTestClass deserialized = JsonConvert.DeserializeObject<SpecifiedTestClass>(json, new JsonSerializerSettings { TraceWriter = traceWriter });

            Assert.Equal("Started deserializing OpenGamingLibrary.Json.Test.Serialization.SpecifiedTestClass. Path 'Age', line 2, position 9.", traceWriter.TraceRecords[0].Message);
            Assert.True(traceWriter.TraceRecords[1].Message.StartsWith("Finished deserializing OpenGamingLibrary.Json.Test.Serialization.SpecifiedTestClass. Path ''"));

            Assert.Null(deserialized.Name);
            Assert.False(deserialized.NameSpecified);
            Assert.False(deserialized.WeightSpecified);
            Assert.False(deserialized.HeightSpecified);
            Assert.False(deserialized.FavoriteNumberSpecified);
            Assert.Equal(27, deserialized.Age);

            c.NameSpecified = true;
            c.WeightSpecified = true;
            c.HeightSpecified = true;
            c.FavoriteNumber = 23;
            json = JsonConvert.SerializeObject(c, Formatting.Indented);

            StringAssert.Equal(@"{
  ""Name"": ""James"",
  ""Age"": 27,
  ""Weight"": 0,
  ""Height"": 0,
  ""FavoriteNumber"": 23
}", json);

            traceWriter = new InMemoryTraceWriter
            {
                LevelFilter = TraceLevel.Verbose
            };

            deserialized = JsonConvert.DeserializeObject<SpecifiedTestClass>(json, new JsonSerializerSettings { TraceWriter = traceWriter });

            Assert.Equal("Started deserializing OpenGamingLibrary.Json.Test.Serialization.SpecifiedTestClass. Path 'Name', line 2, position 10.", traceWriter.TraceRecords[0].Message);
            Assert.Equal("IsSpecified for property 'Name' on OpenGamingLibrary.Json.Test.Serialization.SpecifiedTestClass set to true. Path 'Name', line 2, position 18.", traceWriter.TraceRecords[1].Message);
            Assert.Equal("IsSpecified for property 'Weight' on OpenGamingLibrary.Json.Test.Serialization.SpecifiedTestClass set to true. Path 'Weight', line 4, position 14.", traceWriter.TraceRecords[2].Message);
            Assert.Equal("IsSpecified for property 'Height' on OpenGamingLibrary.Json.Test.Serialization.SpecifiedTestClass set to true. Path 'Height', line 5, position 14.", traceWriter.TraceRecords[3].Message);
            Assert.True(traceWriter.TraceRecords[4].Message.StartsWith("Finished deserializing OpenGamingLibrary.Json.Test.Serialization.SpecifiedTestClass. Path ''"));

            Assert.Equal("James", deserialized.Name);
            Assert.True(deserialized.NameSpecified);
            Assert.True(deserialized.WeightSpecified);
            Assert.True(deserialized.HeightSpecified);
            Assert.True(deserialized.FavoriteNumberSpecified);
            Assert.Equal(27, deserialized.Age);
            Assert.Equal(23, deserialized.FavoriteNumber);
        }
        public void SpecifiedTest()
        {
            SpecifiedTestClass c = new SpecifiedTestClass();
            c.Name = "James";
            c.Age = 27;
            c.NameSpecified = false;

            string json = JsonConvert.SerializeObject(c, Formatting.Indented);

            StringAssert.Equal(@"{
  ""Age"": 27
}", json);

            SpecifiedTestClass deserialized = JsonConvert.DeserializeObject<SpecifiedTestClass>(json);
            Assert.Null(deserialized.Name);
            Assert.False(deserialized.NameSpecified);
            Assert.False(deserialized.WeightSpecified);
            Assert.False(deserialized.HeightSpecified);
            Assert.False(deserialized.FavoriteNumberSpecified);
            Assert.Equal(27, deserialized.Age);

            c.NameSpecified = true;
            c.WeightSpecified = true;
            c.HeightSpecified = true;
            c.FavoriteNumber = 23;
            json = JsonConvert.SerializeObject(c, Formatting.Indented);

            StringAssert.Equal(@"{
  ""Name"": ""James"",
  ""Age"": 27,
  ""Weight"": 0,
  ""Height"": 0,
  ""FavoriteNumber"": 23
}", json);

            deserialized = JsonConvert.DeserializeObject<SpecifiedTestClass>(json);
            Assert.Equal("James", deserialized.Name);
            Assert.True(deserialized.NameSpecified);
            Assert.True(deserialized.WeightSpecified);
            Assert.True(deserialized.HeightSpecified);
            Assert.True(deserialized.FavoriteNumberSpecified);
            Assert.Equal(27, deserialized.Age);
            Assert.Equal(23, deserialized.FavoriteNumber);
        }