????????????μ?To-Do-List:
?????2?????
???????????
?????????
???????????
????????2???
??????????????
????????????Guesser???????????????????????????????????????????????Game!
??????????????Щ??????С??????????????????????GameManager.
??????????μ???????1??????6??GameOver.??2???????????????2???????3?????????????????????????4?????????exit ??????????5?????????????GameOver??
?????????д??Guesser??????????
public interface IGuesser
{
string AnswerNumber { get; }
string Guess(string inputNumber);
}
public class Guesser ??IGuesser
{
public string AnswerNumber { get; private set; }
public Guesser(IAnswerGenerator generator)
{
AnswerNumber = generator.Generate();
}
public string Guess(string inputNumber)
{
...
}
}
    Test First.
???????GameManagerTest
[TestClass]
public class GameManagerTest
{
[TestMethod]
public void should_return_game_over_when_input_times_is_six_and_result_is_wrong()
{
IGuesser guess = new Guesser(new AnswerGeneratorForTest());
var game = new GameManager(guess);
var input = "1368";
var maxtimes = 6;
var actual = false;
for (var time = 0; time < maxtimes; time++)
{
game.Guess(input);
}
actual = game.IsGameOver;
Assert.AreEqual(true?? actual);
}
}