public void UpdateChangesPlayerPositionIfNewPositionIsWalkable(bool isDestinationWalkable) { // Arrange var player = new Entity(); var system = new MovementSystem(player); player.Set(new MoveToKeyboardComponent(player)); player.Position.X = 3; system.Add(player); player.Position.Y = 3; var playerMoved = false; var map = new ArrayMap <AbstractMapTile>(5, 5); for (var y = 0; y < map.Height; y++) { for (var x = 0; x < map.Width; x++) { map[x, y] = new FloorTile(); } } map[player.Position.X - 1, player.Position.Y].IsWalkable = isDestinationWalkable; SadConsole.Global.KeyboardState.KeysPressed.Add(AsciiKey.Get(Keys.Left)); // Update the map in the movement system EventBus.Instance.Broadcast("Map changed", map); EventBus.Instance.Register <Player>("Player moved", (data) => playerMoved = true); var expectedX = isDestinationWalkable ? player.Position.X - 1 : player.Position.X; // Act system.Update(0); // Assert Assert.That(player.Position.X, Is.EqualTo(expectedX)); // Position changed Assert.That(playerMoved, Is.EqualTo(isDestinationWalkable)); // Event fired (or not) }