예제 #1
0
        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"));
        }
예제 #2
0
        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);
        }
예제 #3
0
        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"));
        }