forked from anthonyreilly/NetCoreForce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SOSLTests.cs
51 lines (40 loc) · 1.55 KB
/
SOSLTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.IO;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xunit;
using NetCoreForce.Client;
using NetCoreForce.Client.Models;
using NetCoreForce.Models;
using Newtonsoft.Json;
namespace NetCoreForce.FunctionalTests
{
public class SOSLTests : IClassFixture<ForceClientFixture>
{
ForceClientFixture forceClientFixture;
public SOSLTests(ForceClientFixture fixture)
{
this.forceClientFixture = fixture;
}
[Fact]
public async Task BasicSearch()
{
//TODO: this test assumes certain records will be present, it should create its own sample records to search for
ForceClient client = await forceClientFixture.GetForceClient();
SearchResult<SObjectGeneric> result = await client.Search("FIND {cd*}");
Assert.NotNull(result);
Assert.NotNull(result.SearchRecords);
}
[Fact]
public async Task TypedSearch()
{
//TODO: this test assumes certain records will be present, it should create its own sample records to search for
ForceClient client = await forceClientFixture.GetForceClient();
SearchResult<SfAccount> result = await client.Search<SfAccount>("FIND {cd*} IN ALL FIELDS RETURNING Account (Id, Name)");
Assert.NotNull(result);
Assert.NotNull(result.SearchRecords);
//returned objects should be Accounts
Assert.Equal("Account", result.SearchRecords[0].Attributes.Type);
}
}
}