private static async Task <string> CreateDocument(DocumentClient client, Uri collectionUri, int size) { string _id = DateTime.Now.Ticks.ToString(); TestDocument tDoc = new TestDocument { pkid = _id, value = new string('x', size), id = _id, city = _city[_random.Next(_city.Length - 1)] }; //Create the document ResourceResponse <Document> kbWriteResponse = await client.CreateDocumentAsync(collectionUri, tDoc); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"{size} Bytes document created for { kbWriteResponse.RequestCharge} RUs"); Console.ForegroundColor = ConsoleColor.White; return(_id); }
private static async Task <bool> Create_N_Documents(DocumentClient client, Uri collectionUri, int size, int noOfDocuments) { for (int i = 0; i < noOfDocuments; i++) { string _id = DateTime.Now.Ticks.ToString() + "-" + i; TestDocument tDoc = new TestDocument { pkid = _city[_random.Next(_city.Length - 1)], value = new string('x', size), id = _id, city = _city[_random.Next(_city.Length - 1)] }; //Create the document ResourceResponse <Document> kbWriteResponse = await client.CreateDocumentAsync(collectionUri, tDoc); Console.Write("."); } return(true); }