public void Check <TObject>(Func <string> getXmlString, TObject expectedResult) { var serializer = new SwiftySendSerializer(typeof(TObject)); var result = serializer.Deserialize <TObject>(getXmlString.Invoke()); result.Should().BeEquivalentTo(expectedResult); }
public void Check <TDummy>(Func <string> expectedResult, TDummy testObject) { var swiftySerializer = new SwiftySendSerializer(typeof(TDummy)); var result = swiftySerializer.Serialize(testObject); Assert.Equal(expectedResult.Invoke(), result); }
public void Deserialize_Object_With_Datetime() { var dummy = _fixture.Create <Dummy6>(); var serializer = new SwiftySendSerializer(typeof(Dummy6)); var result = serializer.Deserialize <Dummy6>(XmlRepresentation.GetXml(dummy)); Assert.Equal(result.DateTimeProperty.ToString(), dummy.DateTimeProperty.ToString()); Assert.Equal(result.DateTimeField.ToString(), dummy.DateTimeField.ToString()); }
public void Test1() { var dd = _fixture.Build <DD>() //.With(x => x.ObjectFiled, "random string1") .With(x => x.ObjectProperty, "random string2") .Create(); var ser = new SwiftySendSerializer(typeof(DD)); string xml = ser.Serialize(dd); var newdd = ser.Deserialize <DD>(xml); }
public string SwiftySend_Deserialization_With_Initialization() { var serializer = new SwiftySendSerializer(typeof(Dummy)); foreach (var item in _testDataSwiftySendXmls) { Dummy result = serializer.Deserialize <Dummy>(item); bool a = result.BoolProperty7; } return(serializer.Serialize(_testDataObjects[0])); }
public string SwiftySend_Serialization_With_Initialization() { var serializer = new SwiftySendSerializer(typeof(Dummy)); foreach (var item in _testDataObjects) { string result = serializer.Serialize(item); string m = result; } return(serializer.Serialize(_testDataObjects[0])); }
public void Deserialize_Object_With_Private_Field_And_Property() { var dummy = new Dummy7(_fixture.Create <int>(), _fixture.Create <DateTime>()); var serializer = new SwiftySendSerializer(typeof(Dummy7)); var result = serializer.Deserialize <Dummy7>(XmlRepresentation.GetXml(dummy)); var propertyValue = typeof(Dummy7).GetProperty("IntPrivateProperty", BindingFlags.Instance | BindingFlags.NonPublic); var fieldValue = typeof(Dummy7).GetField("DateTimePrivateField", BindingFlags.Instance | BindingFlags.NonPublic); Assert.Equal(propertyValue.GetValue(result).ToString(), propertyValue.GetValue(dummy).ToString()); Assert.Equal(fieldValue.GetValue(result).ToString(), fieldValue.GetValue(dummy).ToString()); }
public void Deserialize_Object_With_All_Of_The_Base_Types() { var dummy = _fixture .Build <Dummy5>() .With(x => x.ObjectField, "randome string") .Create(); var ser = new SwiftySendSerializer(typeof(Dummy5)); var xml = ser.Serialize(dummy); var rxml = XmlRepresentation.GetXml(dummy); var newdummy = ser.Deserialize <Dummy5>(xml); var newnewdummy = ser.Deserialize <Dummy5>(rxml); Check(() => XmlRepresentation.GetXml(dummy), dummy); }
public void InitializeTest() { YAXSerializer = new YAXSerializer(typeof(Dummy)); SwiftySendSerializer = new SwiftySendSerializer(typeof(Dummy)); for (int i = 0; i < limit; i++) { _testDataObjects.Add(fixture.Create <Dummy>()); } var swifty = new SwiftySendSerializer(typeof(Dummy)); var yax = new YAXSerializer(typeof(Dummy)); foreach (var item in _testDataObjects) { _testDataSwiftySendXmls.Add(swifty.Serialize(item)); _testDataYaxLibXmls.Add(yax.Serialize(item)); } }