Esempio n. 1
0
        public void OnRemoveItemAtPosition_WhenNoItemExists_ThrowsException()
        {
            var position      = Vector2Int.one;
            var boardRegistry = new BoardRegistry <TestBoardItem>();

            Assert.Throws <Exception>(() => boardRegistry.Remove(position));
        }
Esempio n. 2
0
        public void OnGetItem_WhenNoItemExists_ReturnsNull()
        {
            var position      = Vector2Int.one;
            var boardRegistry = new BoardRegistry <TestBoardItem>();

            Assert.That(boardRegistry.Get(position) == null);
        }
Esempio n. 3
0
        public void OnRemoveItem_WhenNoItemExists_ThrowsException()
        {
            var item          = new TestBoardItem(Vector2Int.zero);
            var boardRegistry = new BoardRegistry <TestBoardItem>();

            Assert.Throws <Exception>(() => boardRegistry.Remove(item));
        }
Esempio n. 4
0
        public void OnAddItemTwice_ThrowsException()
        {
            var item          = new TestBoardItem(Vector2Int.one);
            var boardRegistry = new BoardRegistry <TestBoardItem>();

            boardRegistry.Add(item);

            Assert.Throws <Exception>(() => boardRegistry.Add(item));
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        public void OnAddItem_AddsItem()
        {
            var item          = new TestBoardItem(Vector2Int.one);
            var boardRegistry = new BoardRegistry <TestBoardItem>();

            boardRegistry.Add(item);

            Assert.That(boardRegistry.Exists(item));
        }
Esempio n. 7
0
        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));
        }
Esempio n. 8
0
        public void Initialise(List <IActor> actors)
        {
            _actors = new BoardRegistry <IActor>(actors);
            _static = new List <Vector2Int>();

            foreach (var actor in _actors.Items)
            {
                actor.Initialise();
            }
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
 public void Initialise(List <IActor> actors, List <Vector2Int> walls)
 {
     _actors = new BoardRegistry <IActor>(actors);
     _static = walls;
 }