|
1 | 1 | using System; |
| 2 | +using System.Collections.Generic; |
2 | 3 | using System.IO; |
3 | 4 | using System.Linq; |
4 | 5 | using System.Threading.Tasks; |
@@ -458,16 +459,17 @@ class ReadAllLines |
458 | 459 | public async Task GivenFileExist_ExpectDocumentWithBytesReturned() |
459 | 460 | { |
460 | 461 | //---------------Arrange------------------- |
461 | | - var contents = "hi, this is some text for a file"; |
462 | | - |
463 | | - var path = Create_File(contents); |
| 462 | + var path = Create_File_With_Million_Lines(); |
464 | 463 |
|
465 | 464 | var sut = new FileSystem(); |
466 | 465 | //---------------Act---------------------- |
467 | 466 | var actual = await sut.ReadAllLines(path); |
468 | 467 | //---------------Assert----------------------- |
469 | | - var expected = new []{"hi, this is some text for a file"}; |
470 | | - actual.Should().BeEquivalentTo(expected); |
| 468 | + var expectedFirst = "GlobalRank,TldRank,Domain,TLD,RefSubNets,RefIPs,IDN_Domain,IDN_TLD,PrevGlobalRank,PrevTldRank,PrevRefSubNets,PrevRefIPs"; |
| 469 | + var expectedLast = "1000000,499336,alexandrevicenzi.com,com,341,364,alexandrevicenzi.com,com,982364,490355,345,368"; |
| 470 | + actual.Count().Should().Be(1000001); |
| 471 | + actual.FirstOrDefault().Should().BeEquivalentTo(expectedFirst); |
| 472 | + actual.LastOrDefault().Should().BeEquivalentTo(expectedLast); |
471 | 473 | } |
472 | 474 |
|
473 | 475 | [Test] |
@@ -625,6 +627,18 @@ public void GivenFileDoesNotExist_ExpectFalse() |
625 | 627 | } |
626 | 628 | } |
627 | 629 |
|
| 630 | + private static string Create_File_With_Million_Lines() |
| 631 | + { |
| 632 | + var tmp = Path.GetTempPath(); |
| 633 | + var path = Path.Combine(tmp, Guid.NewGuid().ToString()); |
| 634 | + |
| 635 | + var location = TestContext.CurrentContext.WorkDirectory; |
| 636 | + var moveFilePath = Path.Combine(location, "majestic_million.csv"); |
| 637 | + File.Move(moveFilePath, path); |
| 638 | + |
| 639 | + return path; |
| 640 | + } |
| 641 | + |
628 | 642 | private static string Create_File(string content) |
629 | 643 | { |
630 | 644 | var tmp = Path.GetTempPath(); |
|
0 commit comments