XeroAPI / Xero-NetStandard

A wrapper of the Xero API in the .NetStandard 2.0 framework. Supports Accounting, Payroll AU/US, and Files
MIT License
126 stars 124 forks source link

-Please discard, I landed at the wrong github repository and entered a bug report- #426

Closed HHasenack closed 2 years ago

HHasenack commented 2 years ago

This piece of code works just fine using restsharp v107.3.0 but failes when using 108.0.1

public async Task PostTest()
        {
            var calcId = await AddCalculationSetup();

            string paramValue = "InvalidValue";

            // Set a parameter with an invalid value
            var request = new RestRequest($"{url}/CalculationSetups/{calcId}/Parameters/InheritsFromCalcSetup").
                              AddBody(paramValue);
            var response = await restClient.ExecutePostAsync(request); 
            Assert.AreEqual(HttpStatusCode.Created, response.StatusCode, response.Content);
           . . .

The Assert statement fails, and error returned is:

 PostTest
   Source: ValueSetTest.cs line 30
   Duration: 200 ms

  Message: 
Assert.AreEqual failed. Expected:<Created>. Actual:<BadRequest>. {
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "traceId": "00-4fc8ce2dfbaa969137ff4f9482017569-1090e9c87770ee73-00",
  "errors": {
    "$": [
      "'I' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0."
    ],
    "value": [
      "The value field is required."
    ]
  }
}

  Stack Trace: 
ValueSetTest.PostTest() line 40
ThreadOperations.ExecuteWithAbortSafety(Action action)

Am I doing something wrong or is this a bug?