-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathAfterCallTest.cs
More file actions
42 lines (37 loc) · 1.19 KB
/
AfterCallTest.cs
File metadata and controls
42 lines (37 loc) · 1.19 KB
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
using System;
using System.Threading;
using Xunit;
using System.Linq;
namespace RingCentral.Test
{
[Collection("RestClient collection")]
public class AfterCallTest : IDisposable
{
private RestClient rc;
public AfterCallTest(RestClientFixture fixture)
{
rc = fixture.rc;
}
[Fact]
public async void AfterCall()
{
var count = 0;
EventHandler<HttpCallEventArgs> eventHandler = (object sender, HttpCallEventArgs args) =>
{
var rateLimitRemaining = args.HttpCall.Response.Headers.GetValues("X-Rate-Limit-Remaining").FirstOrDefault();
Console.WriteLine(rateLimitRemaining);
count += 1;
};
rc.AfterHttpCall += eventHandler;
const string phoneNumber = "+15889546648";
var addressBook = rc.Restapi().Account().Extension().AddressBook();
var listt = await addressBook.Contact().List(new { phoneNumber = phoneNumber });
rc.AfterHttpCall -= eventHandler;
Assert.Equal(1, count);
}
public void Dispose()
{
Thread.Sleep(100);
}
}
}