1 |
cf35739b
|
Eliška Mourycová
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
2 |
|
|
using ServerApp.User;
|
3 |
|
|
using System;
|
4 |
|
|
using System.Collections.Generic;
|
5 |
|
|
using System.IO;
|
6 |
|
|
using System.Linq;
|
7 |
|
|
using System.Text;
|
8 |
|
|
using System.Threading.Tasks;
|
9 |
|
|
using ServerApp.DataDownload;
|
10 |
4d957345
|
Eliška Mourycová
|
using Moq;
|
11 |
cf35739b
|
Eliška Mourycová
|
|
12 |
|
|
namespace ServerAppFunctionalTests.AdminCommandsTests
|
13 |
|
|
{
|
14 |
|
|
[TestClass]
|
15 |
|
|
public class AdminDataCommandsTesting
|
16 |
|
|
{
|
17 |
|
|
|
18 |
4d957345
|
Eliška Mourycová
|
[TestMethod]
|
19 |
|
|
public void CommandParsingSimple()
|
20 |
cf35739b
|
Eliška Mourycová
|
{
|
21 |
4d957345
|
Eliška Mourycová
|
CommandsAcceptor target = new CommandsAcceptor(null, null);
|
22 |
|
|
PrivateObject obj = new PrivateObject(target);
|
23 |
|
|
Command c = (Command)obj.Invoke("ParseString", "command");
|
24 |
|
|
|
25 |
|
|
Assert.IsNotNull(c);
|
26 |
|
|
Assert.AreEqual("command", c.MainCommand);
|
27 |
|
|
|
28 |
|
|
|
29 |
cf35739b
|
Eliška Mourycová
|
}
|
30 |
|
|
|
31 |
4d957345
|
Eliška Mourycová
|
|
32 |
cf35739b
|
Eliška Mourycová
|
[TestMethod]
|
33 |
4d957345
|
Eliška Mourycová
|
public void CommandParsingFlags()
|
34 |
cf35739b
|
Eliška Mourycová
|
{
|
35 |
4d957345
|
Eliška Mourycová
|
CommandsAcceptor target = new CommandsAcceptor(null, null);
|
36 |
|
|
PrivateObject obj = new PrivateObject(target);
|
37 |
|
|
Command c = (Command)obj.Invoke("ParseString", " command -flag1 data1 data2 -flag2 data3 ");
|
38 |
|
|
|
39 |
|
|
Assert.IsNotNull(c);
|
40 |
|
|
Assert.AreEqual("command", c.MainCommand);
|
41 |
|
|
Assert.AreEqual("command -flag1 data1 data2 -flag2 data3", c.WholeCommand);
|
42 |
|
|
Assert.AreEqual(2, c.FlagsAndData.Count);
|
43 |
|
|
Assert.AreEqual(2, c.FlagsAndData["flag1"].Count);
|
44 |
|
|
Assert.AreEqual("data1", c.FlagsAndData["flag1"][0]);
|
45 |
|
|
Assert.AreEqual("data2", c.FlagsAndData["flag1"][1]);
|
46 |
|
|
Assert.AreEqual(1, c.FlagsAndData["flag2"].Count);
|
47 |
|
|
Assert.AreEqual("data3", c.FlagsAndData["flag2"][0]);
|
48 |
cf35739b
|
Eliška Mourycová
|
|
49 |
|
|
}
|
50 |
|
|
|
51 |
|
|
}
|
52 |
|
|
}
|