public void TestRestSharpHttpPostRequests()
{
Console.WriteLine("Operation start: TestRestSharpHttpPostRequests");
var entity = new PerformanceEntity();
entity.Id = "1234567890123456789012345678901234";
entity.Key = "1234567";
entity.Revision = "1234567";
entity.Name = "Mohamad Abu Bakar";
entity.IcNumber = "1234567-12-3444";
entity.Department = "IT Department";
entity.Height = 1234;
entity.DateOfBirth = new DateTime(2015, 1, 27, 3, 33, 3);
entity.Salary = 3333;
var jsonEntity = JSON.ToJSON(entity);
ServicePointManager.DefaultConnectionLimit = 40;
ServicePointManager.Expect100Continue = false;
ServicePointManager.UseNagleAlgorithm = false;
var client = new RestClient("http://localhost:8529");
var request = new RestRequest("_db/" + Database.TestDatabaseGeneral + "/_api/document", Method.POST);
request.AddParameter("collection", Database.TestDocumentCollectionName);
request.AddBody(jsonEntity);
Stopwatch stopwatch = Stopwatch.StartNew();
for (int i = 0; i < 10000; i++)
{
var response = client.Execute(request);
}
Console.WriteLine("Elapsed time [s]: {0}", stopwatch.Elapsed.TotalMilliseconds / 1000);
Console.WriteLine("Operation end: TestRestSharpHttpPostRequests");
}