public void IsValid_WithInvalidFormat_ThrowsFormatException(string nit) { //Arrange NitValidator validator = new NitValidator(); //Act TestDelegate actionToExecute = () => validator.IsValid(nit); //Assert Assert.That(actionToExecute, Throws.TypeOf <FormatException>().With.Message.ContainsSubstring("#######K")); }
public void IsValid_WithValidFormat_CheckResults(string nit, bool expectedResult) { //Arrange NitValidator validator = new NitValidator(); //Act bool result = validator.IsValid(nit); //Assert Assert.AreEqual(expectedResult, result); }
public void IsValid_WithNullNit_ThrowsArgumentNullException() { //Arrange string nit = null; NitValidator validator = new NitValidator(); //Act TestDelegate actionToExecute = () => validator.IsValid(nit); //Assert Assert.That(actionToExecute, Throws.TypeOf <ArgumentNullException>().With.Message.ContainsSubstring("nit")); }