-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
97 lines (93 loc) · 3.86 KB
/
Program.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using NUnit.Framework;
using SoraCommonNet;
using System.Threading.Tasks;
namespace SoraCommonTest
{
public class Performer
{
readonly string account0Email;
readonly string account0Password;
readonly string account0VerificationCode;
readonly string account1Email;
readonly string account1Password;
readonly string account1FirstSubscriberImsi;
public Performer()
{
account0Email = Properties.Settings.Default.ACCOUNT0_EMAIL;
account0Password = Properties.Settings.Default.ACCOUNT0_PASSWORD;
account0VerificationCode = Properties.Settings.Default.ACCOUNT0_VERIFICATION_CODE;
account1Email = Properties.Settings.Default.ACCOUNT1_EMAIL;
account1Password = Properties.Settings.Default.ACCOUNT1_PASSWORD;
account1FirstSubscriberImsi = Properties.Settings.Default.ACCOUNT1_FIRST_SUBSCRIBER_IMSI;
}
public async Task Perform()
{
/*
// Assert.IsTrue(await Operator.Register(account0Email, account0Password));
// Assert.IsTrue(await Operator.VerifyRegistration(account0VerificationCode));
var op = await Operator.Authenticate(account0Email, account0Password);
Assert.IsNotNull(op);
var opInfo = await op.FetchInfo();
Assert.IsNotNull(opInfo);
Assert.IsNotNullOrEmpty(opInfo.CreateDate);
Assert.IsNullOrEmpty(opInfo.Description);
Assert.IsNotNullOrEmpty(opInfo.Email);
Assert.IsNotNullOrEmpty(opInfo.OperatorId);
Assert.IsNullOrEmpty(opInfo.RootOperatorId);
Assert.IsNotNullOrEmpty(opInfo.UpdateDate);
Assert.IsTrue(await op.RefreshToken());
Assert.IsNotNull(await op.FetchInfo());
Assert.IsNotNullOrEmpty(await op.FetchSupportToken());
*/
var op = await Operator.Authenticate(account1Email, account1Password);
var subscr = await op.RetrieveSubscriber(account1FirstSubscriberImsi);
Assert.IsNotNull(subscr);
Assert.AreEqual(account1FirstSubscriberImsi, subscr.Imsi);
var originalStatus = string.Copy(subscr.Status);
var originalTerminationEnabled = subscr.TerminationEnabled;
Assert.IsTrue(await subscr.EnableTermination());
Assert.IsTrue(await subscr.DisableTermination());
switch (originalTerminationEnabled)
{
case true:
Assert.IsTrue(await subscr.EnableTermination());
break;
case false:
Assert.IsTrue(await subscr.DisableTermination());
break;
}
Assert.IsTrue(await subscr.Deactivate());
Assert.IsTrue(await subscr.Activate());
// restore original status
switch (originalStatus)
{
case "inactive":
Assert.IsTrue(await subscr.Deactivate());
break;
case "active":
Assert.IsTrue(await subscr.Activate());
break;
default:
break;
}
/*
var subscribers = await op.ListSubscribers();
Assert.IsNotNull(subscribers);
Assert.AreNotEqual(0, subscribers.Count);
Assert.AreEqual(subscr.Imsi, subscribers[0].Imsi);
*/
// Assert.IsTrue(await subscr.EnableTermination());
// Assert.IsTrue(await subscr.Activate());
// Assert.IsTrue(await subscr.Deactivate());
// Assert.IsTrue(await subscr.Terminate());
}
}
class Program
{
static void Main(string[] args)
{
var performer = new Performer();
Task.Run(() => performer.Perform()).Wait();
}
}
}