Files
StarterNG/StarterNG.Tests/CouplerLookTests.cs
maj00r 2e7e967279 Say only what a tail coupler does: end signals or none
The simulator reads the last vehicle's coupler for one thing, whether to put
up the end signals. It does not couple the train to anything behind it, as
the tooltip and a comment claimed.
2026-10-04 18:57:58 +02:00

26 lines
1002 B
C#

using StarterNG.Classes;
using StarterNG.Views;
namespace StarterNG.Tests;
public class CouplerLookTests
{
[Theory]
[InlineData("0", CouplerState.Free)]
[InlineData("3", CouplerState.Coupled)]
[InlineData("7", CouplerState.MultipleUnit)]
[InlineData("131", CouplerState.Permanent)]
[InlineData("-3", CouplerState.Permanent)]
[InlineData("0.BP", CouplerState.Free)]
public void A_coupler_between_vehicles_reads_by_what_it_connects(string code, CouplerState expected) =>
Assert.Equal(expected, CouplerLook.StateOf(Coupling.Parse(code), trailing: false));
[Theory]
[InlineData("0", CouplerState.EndSignals)]
[InlineData("0.BP", CouplerState.EndSignals)]
[InlineData("3", CouplerState.NoEndSignals)]
[InlineData("-7", CouplerState.NoEndSignals)]
public void The_back_of_the_train_gets_end_signals_only_at_0(string code, CouplerState expected) =>
Assert.Equal(expected, CouplerLook.StateOf(Coupling.Parse(code), trailing: true));
}