/
CloudClientInvalidApiKeyTest.cs
49 lines (37 loc) · 1.31 KB
/
CloudClientInvalidApiKeyTest.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
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using ScientiaMobile.WurflCloud.Config;
using ScientiaMobile.WurflCloud;
using ScientiaMobile.WurflCloud.Cache;
namespace ScientiaMobile.WurflCloudTest_NUnit
{
[TestClass]
public class CloudClientInvalidApiKeyTest
{
[TestMethod]
public void testInvalidApiKey()
{
var ua = "Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; en-US) AppleWebKit/534.8+ (KHTML, like Gecko) Version/6.0.0.466 Mobile Safari/534.8+";
var config = new DefaultCloudClientConfig
{
ApiKey = "XXXXXX:YYYYYYYYYYYYYYYYYYYInvalidApiKey"
};
var cache = new NoWurflCloudCache();
var manager = new CloudClientManager(config,cache);
var capabilities = new string[0];
WurflCloud.Device.DeviceInfo di = manager.GetDeviceInfo(ua, capabilities);
var apiKeyError = false;
foreach (KeyValuePair<string, string> pair in di.Errors)
{
if (pair.Value.Equals("Invalid API key"))
apiKeyError = true;
}
Assert.IsTrue(apiKeyError);
}
}
}