Klient RestSharp zwraca wszystkie właściwości jako null podczas deserializacji odpowiedzi JSON

Próbuję wykonać bardzo prosty przykład użycia metody RestSharp Execute do wysyłania zapytań do punktu końcowego odpoczynku i serializowania do POCO. Jednak wszystko, czego próbuję, powoduje powstanie obiektu response.Data, który ma wszystkie właściwości o wartości NULL.

Oto odpowiedź JSON:

{
   "Result":
   {
       "Location":
       {
           "BusinessUnit": "BTA",
           "BusinessUnitName": "CASINO",
           "LocationId": "4070",
           "LocationCode": "ZBTA",
           "LocationName": "Name of Casino"
       }
   }
}

Oto mój kod testowy

 [TestMethod]
    public void TestLocationsGetById()
    {
        //given
        var request = new RestRequest();
        request.Resource = serviceEndpoint + "/{singleItemTestId}";
        request.Method = Method.GET;
        request.AddHeader("accept", Configuration.JSONContentType);
        request.RootElement = "Location";
        request.AddParameter("singleItemTestId", singleItemTestId, ParameterType.UrlSegment);
        request.RequestFormat = DataFormat.Json;

        //when
        Location location = api.Execute<Location>(request);            

        //then
        Assert.IsNotNull(location.LocationId); //fails - all properties are returned null

    }

A oto mój kod API

 public T Execute<T>(RestRequest request) where T : new()
    {
        var client = new RestClient();
        client.BaseUrl = Configuration.ESBRestBaseURL;

        //request.OnBeforeDeserialization = resp => { resp.ContentLength = 761; };

        var response = client.Execute<T>(request);
        return response.Data;
    }

I wreszcie, oto mój POCO

 public class Location
{        
    public string BusinessUnit { get; set; }
    public string BusinessUnitName { get; set; }
    public string LocationId { get; set; }
    public string LocationCode { get; set; }
    public string LocationName { get; set; }
}

Ponadto właściwości ErrorException i ErrorResponse w odpowiedzi mają wartość NULL.

Wygląda to na bardzo prosty przypadek, ale cały dzień biegam w kółko! Dzięki.

questionAnswers(1)

yourAnswerToTheQuestion