EDIT: A solution to the question can be found in John Sheehan's first comment!
I would like to use Restsharp as a Rest-Client for my project. Since the REST server is not running yet, I would like to test the client without the server. The focus is on deserializing the returned XML response. Is it possible to deserialize XML using RestSharp without proper RestSharp.RestResponse?
I tried 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; } }
Deserializations creates an object of the Response-Class class, where each field is null. Is there a way to check if (and how) any given xml will be deserialized by RestSharp?
Edit: For better readability, this is the XML I use:
<Response> <Item1>Some text</Item1> <Item2>Another text</Item2> <Item3>Even more text</Item3> </Response>
source share