public void given_a_move_matrix() { before = () => matrix = new MoveMatrix(); context["starting from key 1"] = () => { List<int> answer = null; before = () => { answer = matrix.ReachableFrom(1); }; specify = () => answer.should_contain(6); specify = () => answer.should_contain(8); }; context["starting from key 5"] = () => { List<int> answer = null; before = () => { answer = matrix.ReachableFrom(5); }; specify = () => answer.Count.should_be(0); }; }
public KeyPad(MoveMatrix moveMatrix) { _moveMatrix = moveMatrix; buttons = new List<Key>(12); for (int row = 0; row < 4; row++) { for (int column = 0; column < 3; column++) { buttons.Add(new Key( buttons.Count + 1)); } } }