public void ShouldGenerateRandomValidFormattedNIT() { NITValidator validator = new NITValidator(true); string value = validator.GenerateRandomValid(); validator.AssertValid(value); }
public void shouldValidateNullNIT() { NITValidator validator = new NITValidator(); string value = null; validator.AssertValid(value); }
public void ShouldValidateValidNIT() { NITValidator validator = new NITValidator(); validator.AssertValid("12345678919"); validator.AssertValid("34608514300"); validator.AssertValid("47393545608"); }
public void ShouldValidateValidFormattedNIT() { NITValidator validator = new NITValidator(true); // VALID NIT = 123.45678.91-9 string value = "123.45678.91-9"; validator.AssertValid(value); }
public void ShouldNotValidateNITWithMoreDigitsThanAlowed() { NITValidator validator = new NITValidator(); string value = "123456789012"; try { validator.AssertValid(value); Assert.Fail(); } catch (InvalidStateException e) { Assert.IsTrue(e.GetInvalidMessages().Count == 1); AssertMessage(e, INVALID_DIGITS); } }
public void ShouldNotValidateNITWithInvalidCharacter() { NITValidator validator = new NITValidator(); string value = "1111111a111"; try { validator.AssertValid(value); Assert.Fail(); } catch (InvalidStateException e) { Assert.IsTrue(e.GetInvalidMessages().Count == 1); AssertMessage(e, INVALID_DIGITS); } }
public void ShouldNotValidateNITCheckDigitsWithCheckDigitWrong() { NITValidator validator = new NITValidator(); // VALID NIT = 24.84380.348-0 string value = "24843803470"; try { validator.AssertValid(value); Assert.Fail(); } catch (InvalidStateException e) { Assert.IsTrue(e.GetInvalidMessages().Count == 1); AssertMessage(e, INVALID_CHECK_DIGITS); } }
public void ShouldNotValidateValidUnformattedNIT() { NITValidator validator = new NITValidator(true); // VALID NIT = 12.34567.891-9 string value = "12345678919"; try { validator.AssertValid(value); Assert.Fail(); } catch (InvalidStateException e) { Assert.IsTrue(e.GetInvalidMessages().Count == 1); AssertMessage(e, INVALID_FORMAT); } }