32 lines
987 B
C#
32 lines
987 B
C#
using FluentAssertions;
|
|
using Sand.Core;
|
|
|
|
namespace Sand.Tests;
|
|
|
|
public sealed class ParticleLibraryLoaderTests
|
|
{
|
|
[Fact]
|
|
public void LoadFromDirectory_LoadsCoreDefinitions()
|
|
{
|
|
var library = ParticleLibraryLoader.LoadFromDirectory(GetPartRoot());
|
|
|
|
library.Definitions.Should().NotBeEmpty();
|
|
library.GetTypeId("sand").Should().BeGreaterThan((ushort)0);
|
|
library.GetDefinition(library.GetTypeId("water")).Name.Should().NotBeNullOrWhiteSpace();
|
|
}
|
|
|
|
[Fact]
|
|
public void LoadFromDirectory_NormalizesIdsAndColors()
|
|
{
|
|
var library = ParticleLibraryLoader.LoadFromDirectory(GetPartRoot());
|
|
var stone = library.GetDefinition(library.GetTypeId("stone"));
|
|
|
|
stone.Id.Should().Be("stone");
|
|
stone.Color.R.Should().Be(128);
|
|
stone.Color.G.Should().Be(128);
|
|
stone.Color.B.Should().Be(128);
|
|
}
|
|
|
|
private static string GetPartRoot() => Path.Combine(AppContext.BaseDirectory, "Content", "part");
|
|
}
|