Я автоматизировал запрос на размещение, как показано ниже, но я получаю следующую ошибку:
Язык и инструменты;C # .net, Visual Studio, Selenium
Пожалуйста, найдите соответствующий код
public void ShouldReturnOk_Vehicles()
{
var requestUri = $"{BaseUrl}" + "carts/addtocart?userId=11";
var requestModel = CreateBRIMMessageMapDto();
var requestContent = JsonConvert.SerializeObject(requestModel);
//// Act
var response = PutJsonMethod(requestUri, requestContent);
// Assert
response.StatusCode.Should().Be(HttpStatusCode.OK);
}
Сообщение об ошибке:
Executing request [PUT]
Response Content: {"id":["Cannot deserialize the current JSON object (e.g. {\"name\":\"value\"}) into type 'System.Collections.Generic.List`1[SOSTRest.Application.Contracts.DTO.CartDto]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.\nTo fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.\nPath 'id', line 1, position 6."]}
Response StatusCode: BadRequest