????????????TDD(3)
???????????? ???????[ 2014/1/20 15:46:21 ] ???????????????
????????????μ?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);
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11