Deserialize the incomming data to the T datatype, this method used to deserialize the test cases data to the required entity
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using System.IO;
public class Utilities
{
public static T Deserialize<T>(XmlNode xmlData)
{
// Construct an instance of the XmlSerializer with the type
// of object that is being deserialized.
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
// To read the xml data stream, create a XmlReader obj.
XmlNodeReader xmlNodeReader = new XmlNodeReader(xmlData);
// Call the Deserialize method and cast to the generic <T> type.
T deserializedObj = (T)xmlSerializer.Deserialize(xmlNodeReader);
// Return deserialized object
return deserializedObj;
}
}
Related examples in the same category