private string PrepareSinglePayload(int i) { var serializerSettings = new JsonSerializerSettings(); serializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); string json = JsonConvert.SerializeObject(ValueHelpers.GenerateUser(i.ToString()), serializerSettings); return(json); }
private string PrepareBulkPayload(int size) { var serializerSettings = new JsonSerializerSettings(); serializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); var indexJson = new { Index = new object() }; var serializedIndexJson = JsonConvert.SerializeObject(indexJson, serializerSettings); var payload = new StringBuilder(); for (int i = 1; i <= size; i++) { var user = ValueHelpers.GenerateUser(i.ToString()); string userJson = JsonConvert.SerializeObject(user, serializerSettings); payload.Append(serializedIndexJson); payload.Append(Environment.NewLine); payload.Append(userJson); payload.Append(Environment.NewLine); } return(payload.ToString()); }