-
-
Notifications
You must be signed in to change notification settings - Fork 259
Expand file tree
/
Copy pathClientTests.cs
More file actions
51 lines (46 loc) · 1.72 KB
/
ClientTests.cs
File metadata and controls
51 lines (46 loc) · 1.72 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
43
44
45
46
47
48
49
50
51
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Parse.Infrastructure;
namespace Parse.Tests;
[TestClass]
public class ClientTests
{
[TestMethod]
public void TestParseClientConstructor()
{
ParseClient client = new("appId", "https://api.dummy-parse.com/1/", "dotnetKey");
Assert.AreEqual("appId", client.ServerConnectionData.ApplicationID);
Assert.AreEqual("https://api.dummy-parse.com/1/", client.ServerConnectionData.ServerURI);
Assert.AreEqual("dotnetKey", client.ServerConnectionData.Key);
}
[TestMethod]
public void TestPublicize()
{
ParseClient previous = ParseClient.Instance;
ParseClient client = new("appId", "https://api.dummy-parse.com/1/", "dotnetKey");
try {
client.Publicize();
Assert.AreSame(client, ParseClient.Instance);
} finally {
previous?.Publicize();
}
}
[TestMethod]
public void TestConstructorWithInvalidUri() =>
// Should throw if using the old parse.com URI without Test=true
Assert.ThrowsExactly<InvalidOperationException>(() =>
new ParseClient("appId", "https://api.parse.com/1/", "dotnetKey") { });// Actually, looking at the code, it throws if the URI is EXACTLY "https://api.parse.com/1/"// and Test is not true.
[TestMethod]
public void TestConstructorWithTestTrue()
{
ServerConnectionData data = new()
{
ApplicationID = "appId",
ServerURI = "https://api.parse.com/1/",
Key = "key",
Test = true
};
ParseClient client = new(data);
Assert.AreEqual("https://api.parse.com/1/", client.ServerConnectionData.ServerURI);
}
}