|
1 | 1 | using System;
|
| 2 | +using System.Collections.Generic; |
2 | 3 | using System.Configuration;
|
| 4 | +using System.Diagnostics; |
3 | 5 | using System.Dynamic;
|
4 | 6 | using System.Linq;
|
5 | 7 | using System.Net;
|
@@ -330,6 +332,40 @@ public async Task Update_Account_NameChanged()
|
330 | 332 | Assert.True(result.Name == newName);
|
331 | 333 | }
|
332 | 334 |
|
| 335 | + [Test] |
| 336 | + public async Task UpdateWithHeaders_Lead_StatusChanged() |
| 337 | + { |
| 338 | + const string originalStatus = "Open - Not Contacted"; |
| 339 | + const string newStatus = "In Touch"; |
| 340 | + |
| 341 | + var lead = new Lead {Email = "[email protected]", FirstName = "Lead", LastName = "Status", Company = "Test", Status = originalStatus}; |
| 342 | + var successResponse = await _client.CreateAsync("Lead", lead); |
| 343 | + lead.Status = newStatus; |
| 344 | + await _client.UpdateAsync("Lead", successResponse.Id, lead, new Dictionary<string, string> {["Sforce-Auto-Assign"] = "false"}); |
| 345 | + |
| 346 | + var result = await _client.QueryByIdAsync<Lead>("Lead", successResponse.Id); |
| 347 | + |
| 348 | + Assert.True(result.Status == newStatus); |
| 349 | + } |
| 350 | + |
| 351 | + [Test] |
| 352 | + public async Task Delete_Lead_Deleted() |
| 353 | + { |
| 354 | + var lead = new Lead {Email = "[email protected]"}; |
| 355 | + var queryResult = await _client.QueryAsync<Lead>($"SELECT Id, FirstName, LastName, Company, Status FROM Lead where email = '{lead.Email}'"); |
| 356 | + var foundLead = queryResult.Records.FirstOrDefault(); |
| 357 | + if (foundLead == null) |
| 358 | + { |
| 359 | + //todo: warning |
| 360 | + Debug.WriteLine("Lead was not created"); |
| 361 | + return; |
| 362 | + } |
| 363 | + |
| 364 | + var result = await _client.DeleteAsync("Lead", foundLead.Id); |
| 365 | + |
| 366 | + Assert.True(result); |
| 367 | + } |
| 368 | + |
333 | 369 | [Test]
|
334 | 370 | public async Task Delete_Account_IsSuccess()
|
335 | 371 | {
|
|
0 commit comments