Align frontend pulse contract and tasks
This commit is contained in:
@@ -70,6 +70,31 @@ public sealed class LevelEditorTests
|
||||
Assert.Equal(EConsumerServiceState.Unknown, next.GetProp(new(2, 2)).ElectricityServiceState);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsolationValveToolPlacesCarrierBoundValve()
|
||||
{
|
||||
var level = LevelState.Create("Valve editor", 6, 6);
|
||||
|
||||
var next = LevelEditor.Apply(level, new(2, 2), new() { Tool = EEditorTool.IsolationValve, Carrier = ECarrierType.Fuel });
|
||||
|
||||
Assert.Equal(EPropType.IsolationValve, next.GetProp(new(2, 2)).Type);
|
||||
Assert.Equal(ECarrierType.Fuel, next.GetProp(new(2, 2)).Carrier);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SprinklerToolsPlaceFloorControlAndWallValve()
|
||||
{
|
||||
var level = LevelState.Create("Sprinkler editor", 6, 6);
|
||||
level = level.SetTerrain(new(2, 2), ECellTerrain.Wall);
|
||||
|
||||
var control = LevelEditor.Apply(level, new(1, 2), new() { Tool = EEditorTool.SprinklerControl });
|
||||
var valve = LevelEditor.Apply(control, new(2, 2), new() { Tool = EEditorTool.SprinklerValve });
|
||||
|
||||
Assert.Equal(EPropType.SprinklerControl, valve.GetProp(new(1, 2)).Type);
|
||||
Assert.Equal(EPropType.SprinklerValve, valve.GetProp(new(2, 2)).Type);
|
||||
Assert.Equal(new(2, 1), valve.GetProp(new(2, 2)).OutletPosition);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ElectricityLeakUsesAuthoredWallAccessFace()
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ public sealed class SimulationEngineTests
|
||||
var next = m_Engine.MoveRobot(level, new(2, 1));
|
||||
|
||||
Assert.Equal(new(2, 1), next.Robot.Position);
|
||||
Assert.Equal(0, next.Global.Turn);
|
||||
Assert.Equal(0, next.Global.Pulse);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -434,6 +434,21 @@ public sealed class SimulationEngineTests
|
||||
Assert.Equal(new(6, 3), loaded.Leaks[0].AccessPosition);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LevelSerializationRoundTripsValveAndSprinklerFields()
|
||||
{
|
||||
var level = SprinklerLevel(EPropSwitchState.Disabled);
|
||||
level = level.SetUnderground(new(3, 3), ECarrierType.Fuel, new() { State = EUndergroundState.Intact });
|
||||
level = level.SetProp(new(3, 3), new() { Type = EPropType.IsolationValve, Carrier = ECarrierType.Fuel, SwitchState = EPropSwitchState.Disabled });
|
||||
|
||||
var loaded = LevelSerializer.Deserialize(LevelSerializer.Serialize(level));
|
||||
|
||||
Assert.Equal(EPropType.IsolationValve, loaded.GetProp(new(3, 3)).Type);
|
||||
Assert.Equal(EPropSwitchState.Disabled, loaded.GetProp(new(3, 3)).SwitchState);
|
||||
Assert.Equal(new(2, 1), loaded.GetProp(new(3, 2)).LinkedPosition);
|
||||
Assert.Equal(new(2, 2), loaded.GetProp(new(2, 1)).OutletPosition);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LevelSerializationRejectsOldSchema()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user