public void TestRemoteMethodResponseSerialization_MissingResponseValueElement() { var response = new RemoteMethodResponse(); response.ComponentName = "component"; response.CallId = Guid.NewGuid(); response.ResponseValue = null; var xml = response.Serialize(); xml.Elements(XName.Get("ResponseValue", xml.Name.NamespaceName)).Remove(); var roundtrip = new RemoteMethodResponse(); Assert.IsFalse(roundtrip.Validate(xml)); }
public void TestRemoteMethodResponseSerialization() { var response = new RemoteMethodResponse(); response.ComponentName = "component"; response.CallId = Guid.NewGuid(); response.ResponseValue = 5; var xml = response.Serialize(); var roundtrip = new RemoteMethodResponse(); Assert.IsTrue(roundtrip.Validate(xml)); roundtrip.Deserialize(xml); Assert.IsNotNull(roundtrip); Assert.AreEqual<Guid>(response.CallId, roundtrip.CallId); Assert.AreEqual<string>(response.ComponentName, roundtrip.ComponentName); Assert.AreEqual<int>((int)response.ResponseValue, (int)roundtrip.ResponseValue); }