コード例 #1
0
        public static void AssertPopulatedData(ComplexModel expected, ComplexModel actual)
        {
            var expectedObject = JObject.FromObject(expected);

            expectedObject.Property("NonPersisted").Remove();

            var actualObject = JObject.FromObject(actual);

            actualObject.Property("NonPersisted").Remove();

            Assert.AreEqual(expectedObject, actualObject);
        }
コード例 #2
0
        public void should_handle_numerics_data_as_xml_with_primitive_handler()
        {
            var expected     = SerializationTestHelper.GenerateNumericsModel();
            var serializer   = new XmlSerializer(_mappingRegistry, new[] { new NumericsXmlPrimitiveHandler() });
            var deserializer = new XmlDeserializer(_mappingRegistry, _typeCreator, new[] { new NumericsXmlPrimitiveHandler() });

            var output = serializer.Serialize(expected);

            _outputHelper.WriteLine(output.AsString);

            var actual = deserializer.Deserialize <NumericsTypesModel>(output);

            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        public void check_it_converts_sensibly()
        {
            var model         = SerializationTestHelper.GeneratePopulatedModel();
            var expectdString = Transformer.ToJson(model);

            testOutputHelper.WriteLine("Outputted Json: ");
            testOutputHelper.WriteLine(expectdString);
            var xml = Transformer.FromJsonToXml <ComplexModel>(expectdString);

            testOutputHelper.WriteLine("Converted Xml: ");
            testOutputHelper.WriteLine(xml);
            var binary = Transformer.FromXmlToBinary <ComplexModel>(xml);

            testOutputHelper.WriteLine("Converted Binary: ");
            testOutputHelper.WriteLine(BitConverter.ToString(binary));
            var json = Transformer.FromBinaryToJson <ComplexModel>(binary);

            testOutputHelper.WriteLine("Outputted Json: ");
            testOutputHelper.WriteLine(json);
            Assert.AreEqual(expectdString, json);
        }
コード例 #4
0
 public static void AssertNullableModelData(NullableTypesModel expected, NullableTypesModel actual)
 {
     Assert.AreEqual(actual, expected);
 }
コード例 #5
0
 public static void AsserNulledDynamicTypesData(DynamicTypesModel expected, DynamicTypesModel actual)
 {
     Assert.AreEqual(actual, expected);
 }
コード例 #6
0
 public static void AssertNulledData(ComplexModel expected, ComplexModel actual)
 {
     Assert.AreEqual(actual, expected);
 }