forked from ringcentral/RingCentral.Net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExceptionTest.cs
29 lines (28 loc) · 986 Bytes
/
ExceptionTest.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
using System;
using System.Net;
using Xunit;
namespace RingCentral.Tests
{
public class ExceptionTest
{
[Fact]
public async void WrongPassword()
{
var rc = new RestClient(
Environment.GetEnvironmentVariable("RINGCENTRAL_CLIENT_ID"),
Environment.GetEnvironmentVariable("RINGCENTRAL_CLIENT_SECRET"),
Environment.GetEnvironmentVariable("RINGCENTRAL_SERVER_URL")
);
var re = await Assert.ThrowsAsync<RestException>(async () =>
{
await rc.Authorize(
Environment.GetEnvironmentVariable("RINGCENTRAL_USERNAME"),
Environment.GetEnvironmentVariable("RINGCENTRAL_EXTENSION"),
"wrong-password"
);
});
Assert.Equal(HttpStatusCode.BadRequest, re.httpResponseMessage.StatusCode);
Assert.Contains("invalid_grant", re.Message);
}
}
}