using System.Threading.Tasks;
using DalSoft.RestClient;
using Newtonsoft.Json.Serialization;
public async static Task Main()
var client = new RestClient("https://jsonplaceholder.typicode.com", new Config()
.SetJsonSerializerSettings(new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }));
.Resource<UserResource>(api => api.GetUser(1)).Get()
.Verify<User>(user => user.Username == "Fail")
.Verify<HttpResponseMessage>(response => response.StatusCode == HttpStatusCode.BadRequest);
public class UserResource
public string GetUsers() => "users";
public string GetUser(int userId) => $"{GetUsers()}/{userId}";
public string GetUserPosts(int userId) => $"{GetUser(userId)}/posts";
public int Id { get; set; }
public string Name { get; set; }
public string Username { get; set; }
public string Email { get; set; }
public string Phone { get; set; }
public string Website { get; set; }