55 lines
2.1 KiB
C#
55 lines
2.1 KiB
C#
namespace ReactorMaintenance.Simulation.Tests;
|
|
|
|
public sealed class LevelEditorTests
|
|
{
|
|
[Fact]
|
|
public void DoorToolPlacesSingleFloorDoorProp()
|
|
{
|
|
var level = LevelState.Create("Door editor", 6, 6);
|
|
|
|
var next = LevelEditor.Apply(level, new(2, 2), new() { Tool = EEditorTool.Door });
|
|
|
|
Assert.Equal(EPropType.Door, next.GetProp(new(2, 2)).Type);
|
|
Assert.Equal(EDoorState.Closed, next.GetProp(new(2, 2)).DoorState);
|
|
}
|
|
|
|
[Fact]
|
|
public void ConsumerToolPlacesCarrierAgnosticConsumer()
|
|
{
|
|
var level = LevelState.Create("Consumer editor", 6, 6);
|
|
|
|
var next = LevelEditor.Apply(level, new(2, 2), new() { Tool = EEditorTool.Consumer, Carrier = ECarrierType.Fuel });
|
|
|
|
Assert.Equal(EPropType.Consumer, next.GetProp(new(2, 2)).Type);
|
|
Assert.Equal(EConsumerServiceState.Unknown, next.GetProp(new(2, 2)).FuelServiceState);
|
|
Assert.Equal(EConsumerServiceState.Unknown, next.GetProp(new(2, 2)).CoolantServiceState);
|
|
Assert.Equal(EConsumerServiceState.Unknown, next.GetProp(new(2, 2)).ElectricityServiceState);
|
|
}
|
|
|
|
[Fact]
|
|
public void ElectricityLeakUsesAuthoredWallAccessFace()
|
|
{
|
|
var level = LevelState.Create("Electricity leak editor", 6, 6);
|
|
level = level.SetTerrain(new(2, 2), ECellTerrain.Wall);
|
|
|
|
var next = LevelEditor.SetLeak(level, new(2, 2), new(2, 3), ECarrierType.Electricity);
|
|
var rejected = LevelEditor.SetLeak(next, new(2, 2), new(4, 4), ECarrierType.Electricity);
|
|
|
|
Assert.Single(next.Leaks);
|
|
Assert.Equal(new(2, 3), next.Leaks[0].AccessPosition);
|
|
Assert.Equal(EUndergroundState.Leaking, next.GetUnderground(new(2, 2), ECarrierType.Electricity).State);
|
|
Assert.Equal(next.Leaks, rejected.Leaks);
|
|
}
|
|
|
|
[Fact]
|
|
public void ReactorControlToolCreatesUnboundReactorState()
|
|
{
|
|
var level = LevelState.Create("Reactor editor", 6, 6);
|
|
|
|
var next = LevelEditor.Apply(level, new(2, 2), new() { Tool = EEditorTool.ReactorControl });
|
|
|
|
Assert.Single(next.Reactors);
|
|
Assert.Equal(new(2, 2), next.Reactors[0].ControlPosition);
|
|
Assert.Equal(1, next.Reactors[0].ReactorId);
|
|
}
|
|
} |