Skip to content

Commit

Permalink
Use dedicated test data for file size calculator unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
jtellnes committed Dec 5, 2024
1 parent f9901af commit 1353e5f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
</ItemGroup>

<ItemGroup>
<None Remove="TestData\DiskUsage\docx.docx" />
<None Remove="TestData\DiskUsage\pdf.pdf" />
<None Remove="TestData\FileTypes\docx.docx" />
<None Remove="TestData\FileTypes\pdf.pdf" />
<None Remove="TestData\FileTypes\pdfA-1b.pdf" />
Expand All @@ -39,6 +41,12 @@
</ItemGroup>

<ItemGroup>
<Content Include="TestData\DiskUsage\docx.docx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\DiskUsage\pdf.pdf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\FileTypes\docx.docx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public FileSystemInfoSizeCalculatorTest()
[Trait("Category", "Integration")]
public void ShouldCalculateCorrectTotalFileSize()
{
string pathToFiles = Path.Combine("TestData", "FileTypes");
string pathToFiles = Path.Combine("TestData", "DiskUsage");

var fileSystemInfoSizeCalculator = new FileSystemInfoSizeCalculator(_statusEventHandler);

Expand All @@ -33,15 +33,9 @@ public void ShouldCalculateCorrectTotalFileSize()
}

long docxByteSize = 12895L;
long zipByteSize = 89899L;
long pdfByteSize = 27182L;
long pdfA1bByteSize = 34155L;
long pdfA3aByteSize = 32506L;
long zip2ByteSize = 921L;
long tarByteSize = 7168L;

long totalSize = docxByteSize + zipByteSize + pdfByteSize + pdfA1bByteSize + pdfA3aByteSize + zip2ByteSize + tarByteSize;
_totalFileSize.Should().Be(totalSize); // 7 files which of 3 are archive files
_totalFileSize.Should().Be(docxByteSize + pdfByteSize);
}

private void OnTargetSizeCalculatorFinished(object o, TargetSizeCalculatorEventArgs e)
Expand Down

0 comments on commit 1353e5f

Please sign in to comment.