예제 #1
0
        public void WhenRemovingEntityThatDoesNotExistFromCell_ThenRemoveThrowsArgumentException()
        {
            var entity = new Entity();
            var map    = new TestMap(1, 1);

            Assert.ThrowsException <ArgumentException>(() => map.Remove(0, 0, entity));
        }
예제 #2
0
        public void WhenAddingEntityToCell_ThenEntityIsContainedWhenGettingCell()
        {
            var entity = new Entity();
            var map    = new TestMap(1, 1);

            map.Add(0, 0, entity);

            var cellEntity = map.GetCell(0, 0).Content.Entities.Find(i => i.Equals(entity));

            Assert.AreSame(entity, cellEntity);
        }
예제 #3
0
        public void WhenRemovingEntityFromCell_ThenThatCellNoLongerContainsTheEntity()
        {
            var entity = new Entity();
            var map    = new TestMap(1, 1);

            map.Add(0, 0, entity);

            var preCount = map.GetCell(0, 0).Content.Entities.Count;

            map.Remove(0, 0, entity);
            var postCount = map.GetCell(0, 0).Content.Entities.Count;

            Assert.AreEqual(1, preCount);
            Assert.AreEqual(0, postCount);
        }