Esempio n. 1
0
        public void should_correctly_serialize_nulled_dynamic_data_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 result       = deserializer.Deserialize <DynamicTypesModel>(output);

            SerializationTestHelper.AsserNulledDynamicTypesData(model, result);
        }
Esempio n. 2
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);
        }