1 |
99e5517e
|
A-Konig
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
2 |
|
|
using System;
|
3 |
|
|
using ServerApp.Parser.Parsers;
|
4 |
|
|
using System.Collections.Generic;
|
5 |
|
|
using ServerApp.Parser.OutputInfo;
|
6 |
|
|
|
7 |
|
|
namespace TestProject
|
8 |
|
|
{
|
9 |
|
|
[TestClass]
|
10 |
|
|
public class TestingParser
|
11 |
|
|
{
|
12 |
|
|
[TestMethod]
|
13 |
|
|
public void AbstactClassTest()
|
14 |
|
|
{
|
15 |
|
|
IDataParser p = new DataParser(null);
|
16 |
|
|
List<ActivityInfo> aa = p.AttendanceList;
|
17 |
|
|
List<WeatherInfo> wa = p.WeatherList;
|
18 |
|
|
|
19 |
|
|
DataParser pp = (DataParser)p;
|
20 |
|
|
List<ActivityInfo> ap = pp.AttendanceList;
|
21 |
|
|
List<WeatherInfo> wp = pp.WeatherList;
|
22 |
|
|
|
23 |
|
|
Assert.AreEqual(aa, ap);
|
24 |
|
|
Assert.AreEqual(wa, wp);
|
25 |
|
|
}
|
26 |
|
|
|
27 |
|
|
[TestMethod]
|
28 |
|
|
public void MergeListsNull()
|
29 |
|
|
{
|
30 |
|
|
DataParser target = new DataParser(null);
|
31 |
|
|
PrivateObject obj = new PrivateObject(target);
|
32 |
|
|
|
33 |
|
|
List<ActivityInfo> jis = null;
|
34 |
|
|
List<ActivityInfo> pc = null;
|
35 |
|
|
|
36 |
|
|
List<ActivityInfo> retVal = (List<ActivityInfo>)obj.Invoke("MergeAttendance", jis, pc);
|
37 |
|
|
Assert.AreEqual(0, retVal.Count);
|
38 |
|
|
}
|
39 |
|
|
|
40 |
|
|
[TestMethod]
|
41 |
|
|
public void MergeListsJisNull()
|
42 |
|
|
{
|
43 |
|
|
DataParser target = new DataParser(null);
|
44 |
|
|
PrivateObject obj = new PrivateObject(target);
|
45 |
|
|
|
46 |
|
|
List<ActivityInfo> jis = null;
|
47 |
|
|
List<ActivityInfo> pc = new List<ActivityInfo>();
|
48 |
|
|
|
49 |
|
|
List<ActivityInfo> retVal = (List<ActivityInfo>)obj.Invoke("MergeAttendance", jis, pc);
|
50 |
|
|
Assert.AreEqual(pc, retVal);
|
51 |
|
|
}
|
52 |
|
|
|
53 |
|
|
[TestMethod]
|
54 |
|
|
public void MergeListsPcNull()
|
55 |
|
|
{
|
56 |
|
|
DataParser target = new DataParser(null);
|
57 |
|
|
PrivateObject obj = new PrivateObject(target);
|
58 |
|
|
|
59 |
|
|
List<ActivityInfo> jis = new List<ActivityInfo>();
|
60 |
|
|
List<ActivityInfo> pc = null;
|
61 |
|
|
|
62 |
|
|
List<ActivityInfo> retVal = (List<ActivityInfo>)obj.Invoke("MergeAttendance", jis, pc);
|
63 |
|
|
Assert.AreEqual(jis, retVal);
|
64 |
|
|
}
|
65 |
|
|
}
|
66 |
|
|
}
|