EDIT: The solution to the question can be found in the first comment by John Sheehan!
i would like to use Restsharp as Rest-Client for my Project. Since the REST server is not running yet, I would like to test the client without the Server. My main focus is on the deserialization of the returning XML-Response. Is it possible to deserialize XML using RestSharp without a proper RestSharp.RestResponse?
I tried it like this:
public void testDeserialization()
{
XmlDeserializer d = new XmlDeserializer();
RestSharp.RestResponse response = new RestSharp.RestResponse();
string XML = @"<Response><Item1>Some text</Item1><Item2>Another text</Item2><Item3>Even more text</Item3></Response>";
response.Content = XML;
d.RootElement = "Response";
Response r = d.Deserialize<Response>(response);
}
public class Response
{
public string Item1 { get; set; }
public string Item2 { get; set; }
public string Item3 { get; set; }
}
The deserializations creates an Object of the Response-Class, where every field is null. Is there a way to test if (and how) any given xml would be deserialized by RestSharp?
Edit: For better readability - this is the XML i'm using:
<Response>
<Item1>Some text</Item1>
<Item2>Another text</Item2>
<Item3>Even more text</Item3>
</Response>