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); }
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); }
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); }
public static void AssertNullableModelData(NullableTypesModel expected, NullableTypesModel actual) { Assert.AreEqual(actual, expected); }
public static void AsserNulledDynamicTypesData(DynamicTypesModel expected, DynamicTypesModel actual) { Assert.AreEqual(actual, expected); }
public static void AssertNulledData(ComplexModel expected, ComplexModel actual) { Assert.AreEqual(actual, expected); }