1
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
2
|
using System;
|
3
|
using System.Collections.Generic;
|
4
|
using System.Linq;
|
5
|
using System.Text;
|
6
|
using System.Threading.Tasks;
|
7
|
using ServerApp.Connection;
|
8
|
using ServerApp.Connection.XMLProtocolHandler;
|
9
|
using ServerApp.Predictor;
|
10
|
using ServerApp.DataDownload;
|
11
|
using Date = ServerApp.Connection.XMLProtocolHandler.Date;
|
12
|
using ServerApp.WeatherPredictionParser;
|
13
|
using ServerApp.Parser.InputData;
|
14
|
using ServerApp.Parser.Parsers;
|
15
|
|
16
|
namespace ServerAppFunctionalTests.XMLComTests
|
17
|
{
|
18
|
[TestClass]
|
19
|
public class XMLDateTesting
|
20
|
{
|
21
|
|
22
|
|
23
|
[TestMethod]
|
24
|
public void ModifyTimeSpanShort()
|
25
|
{
|
26
|
ConnectionListenerAsync conn = new ConnectionListenerAsync(0, null);
|
27
|
|
28
|
Date startDate = new Date();
|
29
|
startDate.year = 2019;
|
30
|
startDate.month = 1;
|
31
|
startDate.day = 1;
|
32
|
|
33
|
|
34
|
Date endDate = new Date();
|
35
|
endDate.year = 2019;
|
36
|
endDate.month = 1;
|
37
|
endDate.day = 2;
|
38
|
|
39
|
Date res = conn.CheckTimeSpanModifyEnd(startDate, endDate, 15);
|
40
|
|
41
|
Assert.IsNotNull(res);
|
42
|
Assert.AreEqual(endDate.year, res.year);
|
43
|
Assert.AreEqual(endDate.month, res.month);
|
44
|
Assert.AreEqual(endDate.day, res.day);
|
45
|
|
46
|
}
|
47
|
|
48
|
|
49
|
[TestMethod]
|
50
|
public void ModifyTimeSpanLong()
|
51
|
{
|
52
|
ConnectionListenerAsync conn = new ConnectionListenerAsync(0, null);
|
53
|
|
54
|
Date startDate = new Date();
|
55
|
startDate.year = 2019;
|
56
|
startDate.month = 1;
|
57
|
startDate.day = 1;
|
58
|
|
59
|
|
60
|
Date endDate = new Date();
|
61
|
endDate.year = 2019;
|
62
|
endDate.month = 1;
|
63
|
endDate.day = 30;
|
64
|
|
65
|
Date res = conn.CheckTimeSpanModifyEnd(startDate, endDate, 15);
|
66
|
|
67
|
Assert.IsNotNull(res);
|
68
|
Assert.AreEqual(endDate.year, res.year);
|
69
|
Assert.AreEqual(endDate.month, res.month);
|
70
|
Assert.AreEqual(endDate.day, 16);
|
71
|
|
72
|
}
|
73
|
}
|
74
|
}
|