Всем привет! У меня есть простая структура Brick и метод Move для изменения поля
_position
public struct Brick
{
private Vector3Int _position;
private Vector3Int[] _pattern;
public Brick(Vector3Int position, Vector3Int[] pattern)
{
_position = position;
_pattern = pattern;
}
public Vector3Int Position => _position;
public Vector3Int[] Pattern => _pattern;
public void Move(Vector3Int direction)
{
_position += direction;
}
}
Также есть класс BricksSpace где в конструкторе создается _controllableBrick и в будущем работаю с ним за счет метода LowerControllableBrick
public sealed class BricksSpace
{
private readonly Brick _controllableBrick;
public BricksSpace(Brick controlledBrick)
{
_controllableBrick = controlledBrick;
}
public Vector3Int ControllableBlockPosition => _controllableBrick.Position;
public void LowerControllableBrick()
{
_controllableBrick.Move(Vector3Int.down);
}
}
Но при тесте выдает ошибку:
Expected: (0, 4, 0)
But was: (0, 5, 0)
Код теста:
private BricksSpace _brickSpace;
[SetUp]
public void Setup()
{
Brick controlledBrick = new(Vector3Int.up * 5, BrickPatterns.LBlock);
_brickSpace = new(controlledBrick);
}
[Test]
public void BrickLowerTest()
{
_brickSpace.LowerControllableBrick();
Assert.AreEqual(new Vector3Int(0, 4, 0), _brickSpace.ControllableBlockPosition);
}
В чем проблема?