mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-10-17 07:59:19 +02:00
48 lines
1.8 KiB
C#
48 lines
1.8 KiB
C#
using StarterNG.Infrastructure.Settings;
|
|
|
|
namespace StarterNG.Tests;
|
|
|
|
public class SettingKeyCatalogTests
|
|
{
|
|
[Fact]
|
|
public void A_clamped_key_is_annotated_with_its_default_and_range()
|
|
{
|
|
Assert.Equal("dynamiclights = 7 (0-7)", SettingKeyCatalog.Annotate("dynamiclights"));
|
|
Assert.Equal("starter.bufferscale = 100 (50-200)", SettingKeyCatalog.Annotate("starter.bufferscale"));
|
|
}
|
|
|
|
[Fact]
|
|
public void An_unclamped_key_is_annotated_with_its_default_alone()
|
|
{
|
|
Assert.Equal("maxtexturesize = 4096", SettingKeyCatalog.Annotate("maxtexturesize"));
|
|
Assert.Equal("vsync = false", SettingKeyCatalog.Annotate("vsync"));
|
|
}
|
|
|
|
[Fact]
|
|
public void A_text_valued_key_is_shown_without_a_default()
|
|
{
|
|
// An absent lang means "follow the operating system", not "English", and an
|
|
// absent exe path means "go and find the binary" - neither has a default
|
|
// worth printing.
|
|
Assert.Equal("lang", SettingKeyCatalog.Annotate("lang"));
|
|
Assert.Equal("starter.exe.path", SettingKeyCatalog.Annotate("starter.exe.path"));
|
|
}
|
|
|
|
[Fact]
|
|
public void A_composite_or_unknown_key_is_shown_as_written()
|
|
{
|
|
Assert.Equal("shadowtune", SettingKeyCatalog.Annotate("shadowtune"));
|
|
Assert.Equal("", SettingKeyCatalog.Annotate(null));
|
|
}
|
|
|
|
[Fact]
|
|
public void The_annotation_matches_what_the_serializer_actually_defaults_to()
|
|
{
|
|
var settings = new StarterNG.Domain.Settings.SimulatorSettings();
|
|
new SettingsSerializer().Read(settings, new StarterNG.Classes.ConfigFile());
|
|
|
|
Assert.Equal($"maxtexturesize = {settings.MaxTextureSize}", SettingKeyCatalog.Annotate("maxtexturesize"));
|
|
Assert.Equal($"fieldofview = {settings.FieldOfView} (15-75)", SettingKeyCatalog.Annotate("fieldofview"));
|
|
}
|
|
}
|