public void OnAddItemTwice_ThrowsException() { var item = new TestBoardItem(Vector2Int.one); var boardRegistry = new BoardRegistry <TestBoardItem>(); boardRegistry.Add(item); Assert.Throws <Exception>(() => boardRegistry.Add(item)); }
public void OnAddItem_IfItemAlreadyExistsAtPosition_ThrowsException() { var item = new TestBoardItem(Vector2Int.one); var item2 = new TestBoardItem(Vector2Int.one); var boardRegistry = new BoardRegistry <TestBoardItem>(); boardRegistry.Add(item); Assert.Throws <Exception>(() => boardRegistry.Add(item2)); }
public void OnAddItem_AddsItemAtCorrectPosition() { var item = new TestBoardItem(Vector2Int.one); var boardRegistry = new BoardRegistry <TestBoardItem>(); boardRegistry.Add(item); Assert.That(boardRegistry.Get(Vector2Int.one) == item); }
public void OnAddItem_AddsItem() { var item = new TestBoardItem(Vector2Int.one); var boardRegistry = new BoardRegistry <TestBoardItem>(); boardRegistry.Add(item); Assert.That(boardRegistry.Exists(item)); }
public void Add(IActor actor) { if (_static.Contains(actor.Position)) { ExceptionLogger.Exception($"Tried to add an actor {actor} at a position where a wall exists ({actor.Position})"); } _actors.Add(actor); }
public void OnRemoveItem_RemovesItem() { var position = Vector2Int.one; var item = new TestBoardItem(position); var boardRegistry = new BoardRegistry <TestBoardItem>(); boardRegistry.Add(item); Assert.That(boardRegistry.Get(position) == item); boardRegistry.Remove(item); Assert.That(boardRegistry.Get(position) == null); }