Skip to content

Commit

Permalink
use sep
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikus1993 committed Jan 31, 2024
1 parent 26f9821 commit c864abf
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,8 @@ namespace XboxPromotionCheckerBot.App.Infrastructure.Factories;

public static class FuzzyGameSearcherFactory
{
private sealed class Game
{
public string Title { get; set; }
}

public static GameNameFilter Produce(string filePath)
{
var config = new CsvConfiguration(CultureInfo.InvariantCulture)
{
HasHeaderRecord = true,
};
using var reader = Sep.Reader().FromFile(filePath);

var res = new List<FuzzGame>();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using XboxPromotionCheckerBot.App.Infrastructure.Factories;

namespace XboxPromotionCheckerBot.App.Tests.Infrastructure.Factories;

public class FuzzyGameSearcherFactoryTests
{
[Fact]
public void TestWhenFileIsCorrect()
{
var subject = FuzzyGameSearcherFactory.Produce("./games.csv");

Assert.NotNull(subject);
}

[Fact]
public void TestWhenFileNotExists()
{
var subject = Assert.Throws<FileNotFoundException>(() => FuzzyGameSearcherFactory.Produce("./gamesxD.csv"));

Assert.NotNull(subject);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,10 @@
<Folder Include="Infrastructure\Extensions\" />
</ItemGroup>

<ItemGroup>
<None Update="games.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
5 changes: 5 additions & 0 deletions tests/XboxPromotionCheckerBot.App.Tests/games.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Title
Subnautica
GTA
Elden Ring
palworld

0 comments on commit c864abf

Please sign in to comment.