Skip to content

Commit 57ecb68

Browse files
committed
chore: improved testing with 1mil record file
1 parent 73fd4c5 commit 57ecb68

File tree

3 files changed

+1000026
-5
lines changed

3 files changed

+1000026
-5
lines changed

source/StoneAge.Data.FileSystem.Tests/FileSystemTests.cs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.IO;
34
using System.Linq;
45
using System.Threading.Tasks;
@@ -458,16 +459,17 @@ class ReadAllLines
458459
public async Task GivenFileExist_ExpectDocumentWithBytesReturned()
459460
{
460461
//---------------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();
464463

465464
var sut = new FileSystem();
466465
//---------------Act----------------------
467466
var actual = await sut.ReadAllLines(path);
468467
//---------------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);
471473
}
472474

473475
[Test]
@@ -625,6 +627,18 @@ public void GivenFileDoesNotExist_ExpectFalse()
625627
}
626628
}
627629

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+
628642
private static string Create_File(string content)
629643
{
630644
var tmp = Path.GetTempPath();

source/StoneAge.Data.FileSystem.Tests/StoneAge.FileStore.Tests.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,10 @@
1515
<ProjectReference Include="..\StoneAge.Data.FileSystem\StoneAge.FileStore.csproj" />
1616
</ItemGroup>
1717

18+
<ItemGroup>
19+
<None Update="majestic_million.csv">
20+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
21+
</None>
22+
</ItemGroup>
23+
1824
</Project>

0 commit comments

Comments
 (0)