Exemple #1
0
        public void should_correctly_serialize_nulled_dynamic_data_into_existing_object_with_xml()
        {
            var model      = SerializationTestHelper.GenerateNulledDynamicTypesModel();
            var serializer = new XmlSerializer(_mappingRegistry);

            var output = serializer.Serialize(model);

            testOutputHelper.WriteLine("FileSize: " + output.AsString.Length + " bytes");
            testOutputHelper.WriteLine(output.AsString);

            var deserializer     = new XmlDeserializer(_mappingRegistry, _typeCreator);
            var existingInstance = new DynamicTypesModel();

            deserializer.DeserializeInto(output, existingInstance);

            SerializationTestHelper.AsserNulledDynamicTypesData(model, existingInstance);
        }
        public void should_correctly_serialize_nulled_data_into_existing_object_with_xml()
        {
            var model = SerializationTestHelper.GenerateNulledModel();

            var serializer = new XmlSerializer(_mappingRegistry);
            var output     = serializer.Serialize(model);

            _outputHelper.WriteLine("FileSize: " + output.AsString.Length + " bytes");
            _outputHelper.WriteLine(output.AsString);

            var deserializer = new XmlDeserializer(_mappingRegistry, _typeCreator);
            var result       = new ComplexModel();

            deserializer.DeserializeInto(output, result);

            SerializationTestHelper.AssertNulledData(model, result);
        }