Добрый день, столкнулся з такой проблемой. Нужно проверить правильно ли все возвражает сервер на запрос.
Допустим есть следущий код:
IRestResponse response;
[Test]
public void LoginTest()
{
var client = new RestClient("https://api.site/v1");
var request = new RestRequest("token", Method.POST);
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("grant_type", "password");
request.AddParameter("username", "test@test.com");
request.AddParameter("password", "qweasd");
response = client.Execute(request);
var result = JsonConvert.DeserializeObject<LoginModel>(response.Content);
}
public class LoginModel
{
public string access_token { get; set; }
public string token_type { get; set; }
public int expires_in { get; set; }
public string userName { get; set; }
public string id { get; set; }
public string roles { get; set; }
public string email { get; set; }
public int routeId { get; set; }
public string firstName { get; set; }
public string lastName { get; set; }
public string emailConfirmed { get; set; }
public string lastSendEmail { get; set; }
public string pathPhoto { get; set; }
public string issued { get; set; }
public string expires { get; set; }
}
И нужно проверить не были ли изменено что-то в API-запросе. Что бы возвращало все те же поля, что в LoginModel. Как это можно сделать?