forked from anthonyreilly/NetCoreForce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestConnectionTests.cs
55 lines (47 loc) · 1.7 KB
/
TestConnectionTests.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
52
53
54
55
using System;
using System.IO;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xunit;
using NetCoreForce.Client;
using NetCoreForce.Client.Models;
using Newtonsoft.Json;
using System.Diagnostics;
namespace NetCoreForce.FunctionalTests
{
public class TestConnectionTests : IClassFixture<ForceClientFixture>
{
ForceClientFixture forceClientFixture;
public TestConnectionTests(ForceClientFixture fixture)
{
this.forceClientFixture = fixture;
}
[Fact]
public void TestConnectionBadUrl()
{
AuthInfo authInfo = forceClientFixture.AuthInfo;
ForceClient client = new ForceClient(authInfo);
Assert.False(client.TestConnection("https://badurl"));
Assert.False(client.TestConnection("malformedurl"));
}
[Fact]
public void TestConnection()
{
AuthInfo authInfo = forceClientFixture.AuthInfo;
ForceClient client = new ForceClient(authInfo);
Stopwatch sw = new Stopwatch();
Assert.True(client.TestConnection());
sw.Stop();
Console.WriteLine($"TestConnection() took {sw.ElapsedMilliseconds.ToString()}ms");
}
[Fact]
public void TestConnectionToNa1()
{
AuthInfo authInfo = forceClientFixture.AuthInfo;
ForceClient client = new ForceClient(authInfo);
//Barring any major server reorg in Salesforce, the NA1 production instance should always be there.
//If this test fails, verify that the NA1 instance still exists.
Assert.True(client.TestConnection("https://na1.salesforce.com"));
}
}
}