Revize 3729dcae
Přidáno uživatelem Alex Konig před více než 3 roky(ů)
Server/ServerAppFunctionalTests/ParserTests/WeatherParserTesting.cs | ||
---|---|---|
60 | 60 |
WeatherParser target = new WeatherParser(dl.Object); |
61 | 61 |
PrivateObject obj = new PrivateObject(target); |
62 | 62 |
|
63 |
List<ActivityInfo> jis = new List<ActivityInfo>(); |
|
64 |
List<ActivityInfo> pc = new List<ActivityInfo>(); |
|
65 |
|
|
66 | 63 |
List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsDays", path, new DateTime(2000, 1, 1, 9, 0, 0), new DateTime(2000, 1, 1, 15, 0, 0)); |
67 | 64 |
|
68 | 65 |
Assert.AreEqual(1, retVal.Count); |
... | ... | |
90 | 87 |
WeatherParser target = new WeatherParser(dl.Object); |
91 | 88 |
PrivateObject obj = new PrivateObject(target); |
92 | 89 |
|
93 |
List<ActivityInfo> jis = new List<ActivityInfo>(); |
|
94 |
List<ActivityInfo> pc = new List<ActivityInfo>(); |
|
95 |
|
|
96 | 90 |
List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsDays", path, new DateTime(2000, 1, 1), new DateTime(2001, 1, 1)); |
97 | 91 |
|
98 | 92 |
Assert.AreEqual(2, retVal.Count); |
... | ... | |
121 | 115 |
WeatherParser target = new WeatherParser(dl.Object); |
122 | 116 |
PrivateObject obj = new PrivateObject(target); |
123 | 117 |
|
124 |
List<ActivityInfo> jis = new List<ActivityInfo>(); |
|
125 |
List<ActivityInfo> pc = new List<ActivityInfo>(); |
|
126 |
|
|
127 | 118 |
List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsDays", path, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2000, 1, 1, 11, 0, 0)); |
128 | 119 |
|
129 | 120 |
Assert.AreEqual(1, retVal.Count); |
130 | 121 |
Assert.AreEqual(new WeatherInfo(new DateTime(2000, 1, 1, 7, 0, 0), 6, 100, 1, 10_000, 18 - 7), retVal[0]); |
131 | 122 |
//Assert.AreEqual(new WeatherInfo(new DateTime(2000, 2, 1, 7, 0, 0), 10, 25, 2, 10_000, 18 - 7), retVal[1]); |
132 | 123 |
} |
124 |
|
|
125 |
[TestMethod] |
|
126 |
public void ParseWeatherDayEmpty() |
|
127 |
{ |
|
128 |
string path = ""; |
|
129 |
List<WeatherInstance> data = new List<WeatherInstance>(); |
|
130 |
|
|
131 |
Mock<IDataLoader> dl = new Mock<IDataLoader>(); |
|
132 |
dl.Setup(m => m.LoadWeatherFile(path)).Returns(data); |
|
133 |
|
|
134 |
WeatherParser target = new WeatherParser(dl.Object); |
|
135 |
PrivateObject obj = new PrivateObject(target); |
|
136 |
|
|
137 |
List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsDays", path, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0)); |
|
138 |
|
|
139 |
Assert.AreEqual(0, retVal.Count); |
|
140 |
} |
|
141 |
|
|
142 |
[TestMethod] |
|
143 |
public void ParseWeatherDayNull() |
|
144 |
{ |
|
145 |
string path = ""; |
|
146 |
List<WeatherInstance> data = null; |
|
147 |
|
|
148 |
Mock<IDataLoader> dl = new Mock<IDataLoader>(); |
|
149 |
dl.Setup(m => m.LoadWeatherFile(path)).Returns(data); |
|
150 |
|
|
151 |
WeatherParser target = new WeatherParser(dl.Object); |
|
152 |
PrivateObject obj = new PrivateObject(target); |
|
153 |
|
|
154 |
List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsDays", path, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0)); |
|
155 |
|
|
156 |
Assert.AreEqual(0, retVal.Count); |
|
157 |
} |
|
133 | 158 |
#endregion |
134 | 159 |
|
135 | 160 |
#region Parse hours |
... | ... | |
149 | 174 |
WeatherParser target = new WeatherParser(dl.Object); |
150 | 175 |
PrivateObject obj = new PrivateObject(target); |
151 | 176 |
|
152 |
List<ActivityInfo> jis = new List<ActivityInfo>(); |
|
153 |
List<ActivityInfo> pc = new List<ActivityInfo>(); |
|
154 |
|
|
155 | 177 |
List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsIntervals", path, 2, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0)); |
156 | 178 |
|
157 | 179 |
Assert.AreEqual(1, retVal.Count); |
... | ... | |
186 | 208 |
WeatherParser target = new WeatherParser(dl.Object); |
187 | 209 |
PrivateObject obj = new PrivateObject(target); |
188 | 210 |
|
189 |
List<ActivityInfo> jis = new List<ActivityInfo>(); |
|
190 |
List<ActivityInfo> pc = new List<ActivityInfo>(); |
|
191 |
|
|
192 | 211 |
List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsIntervals", path, 2, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0)); |
193 | 212 |
|
194 | 213 |
Assert.AreEqual(5, retVal.Count); |
... | ... | |
208 | 227 |
Assert.AreEqual(new DateTime(2000, 2, 1, 16, 0, 0), retVal[4].startTime); |
209 | 228 |
} |
210 | 229 |
|
230 |
[TestMethod] |
|
231 |
public void ParseWeatherEmpty() |
|
232 |
{ |
|
233 |
string path = ""; |
|
234 |
List<WeatherInstance> data = new List<WeatherInstance>(); |
|
235 |
|
|
236 |
Mock<IDataLoader> dl = new Mock<IDataLoader>(); |
|
237 |
dl.Setup(m => m.LoadWeatherFile(path)).Returns(data); |
|
238 |
|
|
239 |
WeatherParser target = new WeatherParser(dl.Object); |
|
240 |
PrivateObject obj = new PrivateObject(target); |
|
241 |
|
|
242 |
List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsIntervals", path, 2, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0)); |
|
243 |
|
|
244 |
Assert.AreEqual(0, retVal.Count); |
|
245 |
} |
|
246 |
|
|
247 |
|
|
248 |
[TestMethod] |
|
249 |
public void ParseWeatherNull() |
|
250 |
{ |
|
251 |
string path = ""; |
|
252 |
List<WeatherInstance> data = null; |
|
253 |
|
|
254 |
Mock<IDataLoader> dl = new Mock<IDataLoader>(); |
|
255 |
dl.Setup(m => m.LoadWeatherFile(path)).Returns(data); |
|
256 |
|
|
257 |
WeatherParser target = new WeatherParser(dl.Object); |
|
258 |
PrivateObject obj = new PrivateObject(target); |
|
259 |
|
|
260 |
List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsIntervals", path, 2, new DateTime(2000, 1, 1, 8, 0, 0), new DateTime(2001, 1, 1, 11, 0, 0)); |
|
261 |
|
|
262 |
Assert.AreEqual(0, retVal.Count); |
|
263 |
} |
|
211 | 264 |
|
212 | 265 |
[TestMethod] |
213 | 266 |
public void ParseWeatherHourFiltering() |
... | ... | |
237 | 290 |
WeatherParser target = new WeatherParser(dl.Object); |
238 | 291 |
PrivateObject obj = new PrivateObject(target); |
239 | 292 |
|
240 |
List<ActivityInfo> jis = new List<ActivityInfo>(); |
|
241 |
List<ActivityInfo> pc = new List<ActivityInfo>(); |
|
242 |
|
|
243 | 293 |
List<WeatherInfo> retVal = (List<WeatherInfo>)obj.Invoke("ProcessOneWeatherFileAsIntervals", path, 2, new DateTime(2000, 1, 1, 9, 0, 0), new DateTime(2000, 2, 1, 13, 0, 0)); |
244 | 294 |
|
245 | 295 |
Assert.AreEqual(3, retVal.Count); |
Také k dispozici: Unified diff
re #9037 Empty input testing