??????TDD?????????????????????????μ?????
????To-Do-List:
?????2?????
???????????
?????????
???????????
????????2???
??????????????????????????????
???????ValidationTest?????
??????????????1???????????2??4λ??3???????(4)??????
?????????????????????4?????????????дCASE??
?????????????
[TestClass]
public class ValidatorTest
{
private Validator validator;
[TestInitialize]
public void Init()
{
validator = new Validator();
}
[TestMethod]
public void should_return_input_must_be_four_digits_when_input_figures_digit_is_not_four_digits()
{
var input = "29546";
validator.Validate(input);
var actual = validator.ErrorMsg;
Assert.AreEqual("the input must be four digits."?? actual);
}
[TestMethod]
public void should_return_input_must_be_fully_digital_when_input_is_not_all_digital()
{
var input = "a4s5";
validator.Validate(input);
var actual = validator.ErrorMsg;
Assert.AreEqual("the input must be fully digital."?? actual);
}
[TestMethod]
public void should_return_input_can_not_be_empty_when_input_is_empty()
{
var input = "";
validator.Validate(input);
var actual = validator.ErrorMsg;
Assert.AreEqual("the input can't be empty."?? actual);
}
[TestMethod]
public void should_return_input_can_not_contain_duplicate_when_input_figures_contain_duplicate()
{
var input = "2259";
validator.Validate(input);
var actual = validator.ErrorMsg;
Assert.AreEqual("the input figures can't contain duplicate."?? actual);
}
}