-
Notifications
You must be signed in to change notification settings - Fork 25
/
GlipTasksTest.cs
50 lines (40 loc) · 1.5 KB
/
GlipTasksTest.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
using Xunit;
namespace RingCentral.Tests;
[Collection("Sequential")]
public class GlipTasksTest
{
[Fact]
public async void AllTaskOperations()
{
var rc = await ReusableRestClient.GetInstance();
// Find the group with type "Personal" where you can talk to yourself
var groups = await rc.TeamMessaging().V1().Chats().List(new ListGlipChatsNewParameters
{
type = new[] { "Personal" }
});
var group = groups.records[0];
// Create a task
var task = await rc.TeamMessaging().V1().Chats(group.id).Tasks().Post(new TMCreateTaskRequest
{
subject = "This is a sample task"
});
// List all the tasks in the group
var tasks = await rc.TeamMessaging().V1().Chats(group.id).Tasks().Get();
Assert.True(tasks.records.Length > 0);
// patch the task
await rc.TeamMessaging().V1().Tasks(task.id).Patch(new TMUpdateTaskRequest
{
subject = "This is the new task subject"
});
// complete the task
await rc.TeamMessaging().V1().Tasks(task.id).Complete()
.Post(new TMCompleteTaskRequest { status = "Complete" });
// Get the task
task = await rc.TeamMessaging().V1().Tasks(task.id).Get();
// Check data
Assert.Equal("This is the new task subject", task.subject);
Assert.Equal("Completed", task.status);
// delete the task
await rc.TeamMessaging().V1().Tasks(task.id).Delete();
}
}