94 lines
2.7 KiB
C#
94 lines
2.7 KiB
C#
using Vanguard.Content;
|
|
using Vanguard.Rules.Cards;
|
|
using Xunit;
|
|
|
|
namespace Vanguard.Rules.Tests;
|
|
|
|
public class CatalogTests
|
|
{
|
|
private readonly CardCatalog _catalog = TestCatalog.Instance;
|
|
|
|
[Fact]
|
|
public void Catalog_Has_Expected_Size()
|
|
{
|
|
Assert.Equal(94, _catalog.CardCount);
|
|
Assert.Equal(124, _catalog.PrintingCount);
|
|
}
|
|
|
|
[Fact]
|
|
public void Content_Validation_Reports_No_Errors()
|
|
{
|
|
var report = ContentValidator.Validate(_catalog);
|
|
|
|
Assert.True(
|
|
report.IsValid,
|
|
string.Join(Environment.NewLine, report.Issues
|
|
.Where(i => i.Severity == IssueSeverity.Error)
|
|
.Select(i => $"{i.Code}: {i.Message}")));
|
|
}
|
|
|
|
[Fact]
|
|
public void Parallel_Printings_Link_To_Base()
|
|
{
|
|
var parallels = _catalog.Printings.Where(p => p.IsParallel).ToList();
|
|
|
|
Assert.Equal(12, parallels.Count);
|
|
foreach (var parallel in parallels)
|
|
{
|
|
Assert.NotNull(parallel.BasePrintingId);
|
|
var basePrinting = _catalog.Printing(parallel.BasePrintingId!);
|
|
Assert.Equal(basePrinting.NameId, parallel.NameId);
|
|
Assert.Equal(Rarity.SP, parallel.Rarity);
|
|
}
|
|
}
|
|
|
|
[Fact]
|
|
public void GradeZero_Shield_Invariant_Holds()
|
|
{
|
|
foreach (var card in _catalog.Cards.Where(c => c.Grade == 0))
|
|
{
|
|
var expected = card.Trigger == TriggerType.Draw ? 5000 : 10000;
|
|
Assert.Equal(expected, card.Shield);
|
|
}
|
|
}
|
|
|
|
[Fact]
|
|
public void Bt01_Has_Four_Triggers_Of_Each_Type()
|
|
{
|
|
var bt01 = _catalog.Printings
|
|
.Where(p => p.PrintingId.StartsWith("BT01/", StringComparison.Ordinal) && !p.IsParallel)
|
|
.Select(p => _catalog.CardOf(p.PrintingId))
|
|
.ToList();
|
|
|
|
foreach (var trigger in new[] { TriggerType.Critical, TriggerType.Draw, TriggerType.Stand, TriggerType.Heal })
|
|
{
|
|
Assert.Equal(4, bt01.Count(c => c.Trigger == trigger));
|
|
}
|
|
}
|
|
|
|
[Fact]
|
|
public void Sentinel_Cards_Have_Zero_Shield()
|
|
{
|
|
var sentinels = _catalog.Cards.Where(c => c.IsSentinel).ToList();
|
|
|
|
Assert.Equal(3, sentinels.Count);
|
|
Assert.All(sentinels, c => Assert.Equal(0, c.Shield));
|
|
}
|
|
|
|
[Fact]
|
|
public void Starting_Vanguards_Are_GradeZero_Without_Trigger()
|
|
{
|
|
var starters = _catalog.Printings
|
|
.Where(p => p.PrintingId is "TD01/012EN" or "TD02/012EN")
|
|
.Select(p => _catalog.CardOf(p.PrintingId))
|
|
.ToList();
|
|
|
|
Assert.Equal(2, starters.Count);
|
|
Assert.All(starters, c =>
|
|
{
|
|
Assert.Equal(0, c.Grade);
|
|
Assert.Equal(TriggerType.None, c.Trigger);
|
|
});
|
|
}
|
|
}
|