Add log parser to output added file list sorted by size

This commit is contained in:
2025-04-15 19:24:31 +02:00
parent 54decd3526
commit afcfc0d8c7
9 changed files with 271 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
using ResticLogParser.src;
namespace ResticLogParserTests
{
public class FileSizeTests
{
[TestCase("0 B", 0)]
[TestCase("739 B", 739)]
[TestCase("17.601 KiB", 18023)]
[TestCase("17.601 KB", 17601)]
[TestCase("107.135 MiB", 112339190)]
[TestCase("107.135 MB", 107135000)]
public void Test(string fileSizeText, long expected)
{
Assert.That(FileSize.GetBytesFromString(fileSizeText), Is.EqualTo(expected));
}
}
}

View File

@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.9.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ResticLogParser\ResticLogParser.csproj" />
</ItemGroup>
<ItemGroup>
<Using Include="NUnit.Framework" />
</ItemGroup>
</Project>