28 lines
1.1 KiB
C#
28 lines
1.1 KiB
C#
using Ludarium.Application;
|
|
using Ludarium.Domain;
|
|
|
|
namespace Ludarium.UnitTests;
|
|
|
|
public sealed class LibraryExperiencePolicyTests
|
|
{
|
|
[Fact]
|
|
public void SmartCollectionRulesNormalizeTagsAndPlatform()
|
|
{
|
|
var input = LibraryExperiencePolicy.Normalize(new GameCollectionInput(" Favorites ", " curated ",
|
|
CollectionKind.Smart, new CollectionRule(Platform: "SNES", Tags: [" Co-Op ", "co-op"]), true));
|
|
Assert.Equal("Favorites", input.Name);
|
|
Assert.Equal("snes", input.Rule?.Platform);
|
|
Assert.Equal(["co-op"], Assert.IsType<string[]>(input.Rule?.Tags));
|
|
}
|
|
|
|
[Fact]
|
|
public void PersonalStateRejectsRatingsOutsideDocumentedRange() =>
|
|
Assert.Throws<ArgumentException>(() => LibraryExperiencePolicy.Normalize(new GameUserStateInput(false,
|
|
GamePlayStatus.Backlog, 11, null, null, null, 0, null)));
|
|
|
|
[Fact]
|
|
public void ExternalMediaRejectsInsecureUrls() =>
|
|
Assert.Throws<ArgumentException>(() => LibraryExperiencePolicy.Normalize(new GameMediaInput(
|
|
GameMediaKind.Screenshot, "Screenshot", "http://example.test/image.png")));
|
|
}
|