- Timestamp:
- 05/15/12 13:54:24 (13 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources
- Property svn:mergeinfo changed
/branches/ProblemInstancesRegressionAndClassification (added) merged: 7568-7572,7603,7605-7607,7610,7664-7667,7682-7685,7687,7698,7748-7755,7757-7759,7770-7774,7794,7805,7809-7810
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis-3.4/TableFileParserTest.cs
r7259 r7823 21 21 22 22 using System; 23 using System.Globalization; 23 24 using System.IO; 24 using HeuristicLab.Problems. DataAnalysis;25 using HeuristicLab.Problems.Instances; 25 26 using Microsoft.VisualStudio.TestTools.UnitTesting; 26 27 namespace HeuristicLab.Problems.DataAnalysis_3_4.Tests { … … 32 33 public void ParseCSV() { 33 34 string tempFileName = Path.GetTempFileName(); 34 WriteToFile(tempFileName, 35 @"0.00, 0.00, 0.00, 3.14 35 NumberFormatInfo numberFormat; 36 DateTimeFormatInfo dateFormatInfo; 37 char separator; 38 WriteToFile(tempFileName, 39 @"0.00, 0.00, 0.00, 3.14 36 40 0.00, 0.00, 0.00, 0.00 37 41 0.00, 0.00, 0.00, 0.00 … … 41 45 TableFileParser parser = new TableFileParser(); 42 46 try { 43 parser.Parse(tempFileName); 47 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 48 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 44 49 Assert.AreEqual(6, parser.Rows); 45 50 Assert.AreEqual(4, parser.Columns); … … 53 58 public void ParseCSVWithNames() { 54 59 string tempFileName = Path.GetTempFileName(); 55 WriteToFile(tempFileName, 56 @"x01, x02, x03, x04 60 NumberFormatInfo numberFormat; 61 DateTimeFormatInfo dateFormatInfo; 62 char separator; 63 WriteToFile(tempFileName, 64 @"x01, x02, x03, x04 57 65 0.00, 0.00, 0.00, 3.14 58 66 0.00, 0.00, 0.00, 0.00 … … 63 71 TableFileParser parser = new TableFileParser(); 64 72 try { 65 parser.Parse(tempFileName); 73 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 74 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 66 75 Assert.AreEqual(6, parser.Rows); 67 76 Assert.AreEqual(4, parser.Columns); … … 76 85 public void ParseGermanCSV() { 77 86 string tempFileName = Path.GetTempFileName(); 78 WriteToFile(tempFileName, 79 @"0,00; 0,00; 0,00; 3,14 87 NumberFormatInfo numberFormat; 88 DateTimeFormatInfo dateFormatInfo; 89 char separator; 90 WriteToFile(tempFileName, 91 @"0,00; 0,00; 0,00; 3,14 80 92 0,00; 0,00; 0,00; 0,00 81 93 0,00; 0,00; 0,00; 0,00 … … 85 97 TableFileParser parser = new TableFileParser(); 86 98 try { 87 parser.Parse(tempFileName); 99 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 100 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 88 101 Assert.AreEqual(6, parser.Rows); 89 102 Assert.AreEqual(4, parser.Columns); … … 98 111 public void ParseGermanCSVWithNames() { 99 112 string tempFileName = Path.GetTempFileName(); 100 WriteToFile(tempFileName, 101 @"x01; x02; x03; x04 113 NumberFormatInfo numberFormat; 114 DateTimeFormatInfo dateFormatInfo; 115 char separator; 116 WriteToFile(tempFileName, 117 @"x01; x02; x03; x04 102 118 0,00; 0,00; 0,00; 3,14 103 119 0,00; 0,00; 0,00; 0,00 … … 108 124 TableFileParser parser = new TableFileParser(); 109 125 try { 110 parser.Parse(tempFileName); 126 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 127 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 111 128 Assert.AreEqual(6, parser.Rows); 112 129 Assert.AreEqual(4, parser.Columns); … … 121 138 public void ParseGermanCSVWithoutCommas() { 122 139 string tempFileName = Path.GetTempFileName(); 123 WriteToFile(tempFileName, 124 @"0; 0; 0; 3 140 NumberFormatInfo numberFormat; 141 DateTimeFormatInfo dateFormatInfo; 142 char separator; 143 WriteToFile(tempFileName, 144 @"0; 0; 0; 3 125 145 0; 0; 0; 0 126 146 0; 0; 0; 0 … … 130 150 TableFileParser parser = new TableFileParser(); 131 151 try { 132 parser.Parse(tempFileName); 152 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 153 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 133 154 Assert.AreEqual(6, parser.Rows); 134 155 Assert.AreEqual(4, parser.Columns); … … 142 163 public void ParseGermanCSVWithoutCommasWithNames() { 143 164 string tempFileName = Path.GetTempFileName(); 144 WriteToFile(tempFileName, 145 @"x01; x02; x03; x04 165 NumberFormatInfo numberFormat; 166 DateTimeFormatInfo dateFormatInfo; 167 char separator; 168 WriteToFile(tempFileName, 169 @"x01; x02; x03; x04 146 170 0; 0; 0; 3 147 171 0; 0; 0; 0 … … 152 176 TableFileParser parser = new TableFileParser(); 153 177 try { 154 parser.Parse(tempFileName); 178 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 179 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 155 180 Assert.AreEqual(6, parser.Rows); 156 181 Assert.AreEqual(4, parser.Columns); … … 165 190 public void ParseEnglishCSVWithoutCommas() { 166 191 string tempFileName = Path.GetTempFileName(); 167 WriteToFile(tempFileName, 168 @"0, 0, 0, 3 192 NumberFormatInfo numberFormat; 193 DateTimeFormatInfo dateFormatInfo; 194 char separator; 195 WriteToFile(tempFileName, 196 @"0, 0, 0, 3 169 197 0, 0, 0, 0 170 198 0, 0, 0, 0 … … 174 202 TableFileParser parser = new TableFileParser(); 175 203 try { 176 parser.Parse(tempFileName); 204 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 205 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 177 206 Assert.AreEqual(6, parser.Rows); 178 207 Assert.AreEqual(4, parser.Columns); … … 187 216 public void ParseEnglishCSVWithoutCommasWithoutSpace() { 188 217 string tempFileName = Path.GetTempFileName(); 189 WriteToFile(tempFileName, 190 @"0,0,0,3 218 NumberFormatInfo numberFormat; 219 DateTimeFormatInfo dateFormatInfo; 220 char separator; 221 WriteToFile(tempFileName, 222 @"0,0,0,3 191 223 0,0,0,0 192 224 0,0,0,0 … … 196 228 TableFileParser parser = new TableFileParser(); 197 229 try { 198 parser.Parse(tempFileName); 230 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 231 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 199 232 Assert.AreEqual(6, parser.Rows); 200 233 Assert.AreEqual(4, parser.Columns); … … 209 242 public void ParseEnglishCSVWithoutCommasWithNames() { 210 243 string tempFileName = Path.GetTempFileName(); 211 WriteToFile(tempFileName, 212 @"x01, x02, x03, x04 244 NumberFormatInfo numberFormat; 245 DateTimeFormatInfo dateFormatInfo; 246 char separator; 247 WriteToFile(tempFileName, 248 @"x01, x02, x03, x04 213 249 0, 0, 0, 3 214 250 0, 0, 0, 0 … … 219 255 TableFileParser parser = new TableFileParser(); 220 256 try { 221 parser.Parse(tempFileName); 257 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 258 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 222 259 Assert.AreEqual(6, parser.Rows); 223 260 Assert.AreEqual(4, parser.Columns); … … 232 269 public void ParseEnglishCSVWithoutCommasWithoutSpacesWithNames() { 233 270 string tempFileName = Path.GetTempFileName(); 234 WriteToFile(tempFileName, 235 @"x01,x02,x03,x04 271 NumberFormatInfo numberFormat; 272 DateTimeFormatInfo dateFormatInfo; 273 char separator; 274 WriteToFile(tempFileName, 275 @"x01,x02,x03,x04 236 276 0,0,0,3 237 277 0,0,0,0 … … 242 282 TableFileParser parser = new TableFileParser(); 243 283 try { 244 parser.Parse(tempFileName); 284 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 285 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 245 286 Assert.AreEqual(6, parser.Rows); 246 287 Assert.AreEqual(4, parser.Columns); … … 256 297 public void ParseGermanTabSeparated() { 257 298 string tempFileName = Path.GetTempFileName(); 258 WriteToFile(tempFileName, 259 "0,00\t 0,00\t 0,00\t 3,14" + Environment.NewLine + 260 "0,00\t 0,00\t 0,00\t 0,00" + Environment.NewLine + 261 "0,00\t 0,00\t 0,00\t 0,00" + Environment.NewLine + 262 "0,00\t 0,00\t 0,00\t 0,00" + Environment.NewLine + 263 "0,00\t 0,00\t 0,00\t 0,00" + Environment.NewLine + 264 "0,00\t 0,00\t 0,00\t 0,00"); 265 TableFileParser parser = new TableFileParser(); 266 try { 267 parser.Parse(tempFileName); 299 NumberFormatInfo numberFormat; 300 DateTimeFormatInfo dateFormatInfo; 301 char separator; 302 WriteToFile(tempFileName, 303 "0,00\t 0,00\t 0,00\t 3,14" + Environment.NewLine + 304 "0,00\t 0,00\t 0,00\t 0,00" + Environment.NewLine + 305 "0,00\t 0,00\t 0,00\t 0,00" + Environment.NewLine + 306 "0,00\t 0,00\t 0,00\t 0,00" + Environment.NewLine + 307 "0,00\t 0,00\t 0,00\t 0,00" + Environment.NewLine + 308 "0,00\t 0,00\t 0,00\t 0,00"); 309 TableFileParser parser = new TableFileParser(); 310 try { 311 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 312 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 268 313 Assert.AreEqual(6, parser.Rows); 269 314 Assert.AreEqual(4, parser.Columns); … … 278 323 public void ParseGermanTabSeparatedWithNames() { 279 324 string tempFileName = Path.GetTempFileName(); 280 WriteToFile(tempFileName, 281 "x01\t x02\t x03\t x04" + Environment.NewLine + 282 "0,00\t 0,00\t 0,00\t 3,14" + Environment.NewLine + 283 "0,00\t 0,00\t 0,00\t 0,00" + Environment.NewLine + 284 "0,00\t 0,00\t 0,00\t 0,00" + Environment.NewLine + 285 "0,00\t 0,00\t 0,00\t 0,00" + Environment.NewLine + 286 "0,00\t 0,00\t 0,00\t 0,00" + Environment.NewLine + 287 "0,00\t 0,00\t 0,00\t 0,00"); 288 TableFileParser parser = new TableFileParser(); 289 try { 290 parser.Parse(tempFileName); 325 NumberFormatInfo numberFormat; 326 DateTimeFormatInfo dateFormatInfo; 327 char separator; 328 WriteToFile(tempFileName, 329 "x01\t x02\t x03\t x04" + Environment.NewLine + 330 "0,00\t 0,00\t 0,00\t 3,14" + Environment.NewLine + 331 "0,00\t 0,00\t 0,00\t 0,00" + Environment.NewLine + 332 "0,00\t 0,00\t 0,00\t 0,00" + Environment.NewLine + 333 "0,00\t 0,00\t 0,00\t 0,00" + Environment.NewLine + 334 "0,00\t 0,00\t 0,00\t 0,00" + Environment.NewLine + 335 "0,00\t 0,00\t 0,00\t 0,00"); 336 TableFileParser parser = new TableFileParser(); 337 try { 338 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 339 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 291 340 Assert.AreEqual(6, parser.Rows); 292 341 Assert.AreEqual(4, parser.Columns); … … 301 350 public void ParseEnglishTabSeparated() { 302 351 string tempFileName = Path.GetTempFileName(); 303 WriteToFile(tempFileName, 304 "0.00\t 0.00\t 0.00\t 3.14" + Environment.NewLine + 305 "0.00\t 0.00\t 0.00\t 0.00" + Environment.NewLine + 306 "0.00\t 0.00\t 0.00\t 0.00" + Environment.NewLine + 307 "0.00\t 0.00\t 0.00\t 0.00" + Environment.NewLine + 308 "0.00\t 0.00\t 0.00\t 0.00" + Environment.NewLine + 309 "0.00\t 0.00\t 0.00\t 0.00"); 310 TableFileParser parser = new TableFileParser(); 311 try { 312 parser.Parse(tempFileName); 352 NumberFormatInfo numberFormat; 353 DateTimeFormatInfo dateFormatInfo; 354 char separator; 355 WriteToFile(tempFileName, 356 "0.00\t 0.00\t 0.00\t 3.14" + Environment.NewLine + 357 "0.00\t 0.00\t 0.00\t 0.00" + Environment.NewLine + 358 "0.00\t 0.00\t 0.00\t 0.00" + Environment.NewLine + 359 "0.00\t 0.00\t 0.00\t 0.00" + Environment.NewLine + 360 "0.00\t 0.00\t 0.00\t 0.00" + Environment.NewLine + 361 "0.00\t 0.00\t 0.00\t 0.00"); 362 TableFileParser parser = new TableFileParser(); 363 try { 364 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 365 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 313 366 Assert.AreEqual(6, parser.Rows); 314 367 Assert.AreEqual(4, parser.Columns); … … 322 375 public void ParseEnglishTabSeparatedWithNames() { 323 376 string tempFileName = Path.GetTempFileName(); 324 WriteToFile(tempFileName, 325 "x01\t x02\t x03\t x04" + Environment.NewLine + 326 "0.00\t 0.00\t 0.00\t 3.14" + Environment.NewLine + 327 "0.00\t 0.00\t 0.00\t 0.00" + Environment.NewLine + 328 "0.00\t 0.00\t 0.00\t 0.00" + Environment.NewLine + 329 "0.00\t 0.00\t 0.00\t 0.00" + Environment.NewLine + 330 "0.00\t 0.00\t 0.00\t 0.00" + Environment.NewLine + 331 "0.00\t 0.00\t 0.00\t 0.00"); 332 TableFileParser parser = new TableFileParser(); 333 try { 334 parser.Parse(tempFileName); 377 NumberFormatInfo numberFormat; 378 DateTimeFormatInfo dateFormatInfo; 379 char separator; 380 WriteToFile(tempFileName, 381 "x01\t x02\t x03\t x04" + Environment.NewLine + 382 "0.00\t 0.00\t 0.00\t 3.14" + Environment.NewLine + 383 "0.00\t 0.00\t 0.00\t 0.00" + Environment.NewLine + 384 "0.00\t 0.00\t 0.00\t 0.00" + Environment.NewLine + 385 "0.00\t 0.00\t 0.00\t 0.00" + Environment.NewLine + 386 "0.00\t 0.00\t 0.00\t 0.00" + Environment.NewLine + 387 "0.00\t 0.00\t 0.00\t 0.00"); 388 TableFileParser parser = new TableFileParser(); 389 try { 390 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 391 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 335 392 Assert.AreEqual(6, parser.Rows); 336 393 Assert.AreEqual(4, parser.Columns); … … 345 402 public void ParseTabSeparatedWithoutCommas() { 346 403 string tempFileName = Path.GetTempFileName(); 347 WriteToFile(tempFileName, 348 "0\t 0\t 0\t 3" + Environment.NewLine + 349 "0\t 0\t 0\t 0" + Environment.NewLine + 350 "0\t 0\t 0\t 0" + Environment.NewLine + 351 "0\t 0\t 0\t 0" + Environment.NewLine + 352 "0\t 0\t 0\t 0" + Environment.NewLine + 353 "0\t 0\t 0\t 0"); 354 TableFileParser parser = new TableFileParser(); 355 try { 356 parser.Parse(tempFileName); 404 NumberFormatInfo numberFormat; 405 DateTimeFormatInfo dateFormatInfo; 406 char separator; 407 WriteToFile(tempFileName, 408 "0\t 0\t 0\t 3" + Environment.NewLine + 409 "0\t 0\t 0\t 0" + Environment.NewLine + 410 "0\t 0\t 0\t 0" + Environment.NewLine + 411 "0\t 0\t 0\t 0" + Environment.NewLine + 412 "0\t 0\t 0\t 0" + Environment.NewLine + 413 "0\t 0\t 0\t 0"); 414 TableFileParser parser = new TableFileParser(); 415 try { 416 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 417 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 357 418 Assert.AreEqual(6, parser.Rows); 358 419 Assert.AreEqual(4, parser.Columns); … … 366 427 public void ParseTabSeparatedWithoutCommasWithNames() { 367 428 string tempFileName = Path.GetTempFileName(); 368 WriteToFile(tempFileName, 369 "x01\t x02\t x03\t x04" + Environment.NewLine + 370 "0\t 0\t 0\t 3" + Environment.NewLine + 371 "0\t 0\t 0\t 0" + Environment.NewLine + 372 "0\t 0\t 0\t 0" + Environment.NewLine + 373 "0\t 0\t 0\t 0" + Environment.NewLine + 374 "0\t 0\t 0\t 0" + Environment.NewLine + 375 "0\t 0\t 0\t 0"); 376 TableFileParser parser = new TableFileParser(); 377 try { 378 parser.Parse(tempFileName); 429 NumberFormatInfo numberFormat; 430 DateTimeFormatInfo dateFormatInfo; 431 char separator; 432 WriteToFile(tempFileName, 433 "x01\t x02\t x03\t x04" + Environment.NewLine + 434 "0\t 0\t 0\t 3" + Environment.NewLine + 435 "0\t 0\t 0\t 0" + Environment.NewLine + 436 "0\t 0\t 0\t 0" + Environment.NewLine + 437 "0\t 0\t 0\t 0" + Environment.NewLine + 438 "0\t 0\t 0\t 0" + Environment.NewLine + 439 "0\t 0\t 0\t 0"); 440 TableFileParser parser = new TableFileParser(); 441 try { 442 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 443 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 379 444 Assert.AreEqual(6, parser.Rows); 380 445 Assert.AreEqual(4, parser.Columns); … … 389 454 public void ParseWithEmtpyLines() { 390 455 string tempFileName = Path.GetTempFileName(); 391 WriteToFile(tempFileName, 392 "x01\t x02\t x03\t x04" + Environment.NewLine + 393 "0\t 0\t 0\t 3" + Environment.NewLine + 394 Environment.NewLine + 395 "0\t 0\t 0\t 0" + Environment.NewLine + 396 " " + Environment.NewLine + 397 "0\t 0\t 0\t 0" + Environment.NewLine + 398 "0\t 0\t 0\t 0" + Environment.NewLine + Environment.NewLine); 399 TableFileParser parser = new TableFileParser(); 400 try { 401 parser.Parse(tempFileName); 456 NumberFormatInfo numberFormat; 457 DateTimeFormatInfo dateFormatInfo; 458 char separator; 459 WriteToFile(tempFileName, 460 "x01\t x02\t x03\t x04" + Environment.NewLine + 461 "0\t 0\t 0\t 3" + Environment.NewLine + 462 Environment.NewLine + 463 "0\t 0\t 0\t 0" + Environment.NewLine + 464 " " + Environment.NewLine + 465 "0\t 0\t 0\t 0" + Environment.NewLine + 466 "0\t 0\t 0\t 0" + Environment.NewLine + Environment.NewLine); 467 TableFileParser parser = new TableFileParser(); 468 try { 469 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 470 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 402 471 Assert.AreEqual(4, parser.Rows); 403 472 Assert.AreEqual(4, parser.Columns); … … 411 480 public void ParseGermanSpaceSeparated() { 412 481 string tempFileName = Path.GetTempFileName(); 413 WriteToFile(tempFileName, 414 @"0,00 0,00 0,00 3,14 482 NumberFormatInfo numberFormat; 483 DateTimeFormatInfo dateFormatInfo; 484 char separator; 485 WriteToFile(tempFileName, 486 @"0,00 0,00 0,00 3,14 415 487 0,00 0,00 0,00 0,00 416 488 0,00 0,00 0,00 0,00 … … 420 492 TableFileParser parser = new TableFileParser(); 421 493 try { 422 parser.Parse(tempFileName); 494 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 495 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 423 496 Assert.AreEqual(6, parser.Rows); 424 497 Assert.AreEqual(4, parser.Columns); … … 432 505 public void ParseGermanSpaceSeparatedWithNames() { 433 506 string tempFileName = Path.GetTempFileName(); 434 WriteToFile(tempFileName, 435 @"x01 x02 x03 x04 507 NumberFormatInfo numberFormat; 508 DateTimeFormatInfo dateFormatInfo; 509 char separator; 510 WriteToFile(tempFileName, 511 @"x01 x02 x03 x04 436 512 0,00 0,00 0,00 3,14 437 513 0,00 0,00 0,00 0,00 … … 442 518 TableFileParser parser = new TableFileParser(); 443 519 try { 444 parser.Parse(tempFileName); 520 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 521 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 445 522 Assert.AreEqual(6, parser.Rows); 446 523 Assert.AreEqual(4, parser.Columns); … … 455 532 public void ParseEnglishSpaceSeparated() { 456 533 string tempFileName = Path.GetTempFileName(); 457 WriteToFile(tempFileName, 458 @"0.00 0.00 0.00 3.14 534 NumberFormatInfo numberFormat; 535 DateTimeFormatInfo dateFormatInfo; 536 char separator; 537 WriteToFile(tempFileName, 538 @"0.00 0.00 0.00 3.14 459 539 0.00 0.00 0.00 0.00 460 540 0.00 0.00 0.00 0.00 … … 464 544 TableFileParser parser = new TableFileParser(); 465 545 try { 466 parser.Parse(tempFileName); 546 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 547 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 467 548 Assert.AreEqual(6, parser.Rows); 468 549 Assert.AreEqual(4, parser.Columns); … … 476 557 public void ParseEnglishSpaceSeparatedWithNames() { 477 558 string tempFileName = Path.GetTempFileName(); 478 WriteToFile(tempFileName, 479 @"x01 x02 x03 x04 559 NumberFormatInfo numberFormat; 560 DateTimeFormatInfo dateFormatInfo; 561 char separator; 562 WriteToFile(tempFileName, 563 @"x01 x02 x03 x04 480 564 0.00 0.00 0.00 3.14 481 565 0.00 0.00 0.00 0.00 … … 486 570 TableFileParser parser = new TableFileParser(); 487 571 try { 488 parser.Parse(tempFileName); 572 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 573 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 489 574 Assert.AreEqual(6, parser.Rows); 490 575 Assert.AreEqual(4, parser.Columns); … … 499 584 public void ParseSpaceSeparatedWithoutCommas() { 500 585 string tempFileName = Path.GetTempFileName(); 501 WriteToFile(tempFileName, 502 @"0 0 0 3 586 NumberFormatInfo numberFormat; 587 DateTimeFormatInfo dateFormatInfo; 588 char separator; 589 WriteToFile(tempFileName, 590 @"0 0 0 3 503 591 0 0 0 0 504 592 0 0 0 0 … … 508 596 TableFileParser parser = new TableFileParser(); 509 597 try { 510 parser.Parse(tempFileName); 598 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 599 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 511 600 Assert.AreEqual(6, parser.Rows); 512 601 Assert.AreEqual(4, parser.Columns); … … 520 609 public void ParseSpaceSeparatedWithoutCommasWithNames() { 521 610 string tempFileName = Path.GetTempFileName(); 522 WriteToFile(tempFileName, 523 @"x01 x02 x03 x04 611 NumberFormatInfo numberFormat; 612 DateTimeFormatInfo dateFormatInfo; 613 char separator; 614 WriteToFile(tempFileName, 615 @"x01 x02 x03 x04 524 616 0 0 0 3 525 617 0 0 0 0 … … 530 622 TableFileParser parser = new TableFileParser(); 531 623 try { 532 parser.Parse(tempFileName); 624 TableFileParser.DetermineFileFormat(tempFileName, out numberFormat, out dateFormatInfo, out separator); 625 parser.Parse(tempFileName, numberFormat, dateFormatInfo, separator); 533 626 Assert.AreEqual(6, parser.Rows); 534 627 Assert.AreEqual(4, parser.Columns);
Note: See TracChangeset
for help on using the changeset viewer.