Example #1
0
        public void ValidateMethodShouldBeTurnTrueForValidEgn_ForOneTest()
        {
            //arrange
            var validate = new EgnValidator();

            Assert.Throws <ArgumentNullException>(() => validate.IsValid(null));
            //act
            var result = validate.IsValid("6101057509");

            //exceptions
            Assert.That(() => validate.IsValid(null), Throws.ArgumentNullException);
            Assert.Throws <ArgumentNullException>(() => validate.IsValid(null));
            //Assert
            Assert.IsTrue(result);
        }
Example #2
0
        public void IsValidMethodHandlingNullException()
        {
            Console.WriteLine("In test");
            var validator = new EgnValidator();

            Assert.Throws <ArgumentNullException>(() => validator.IsValid(null));
        }
Example #3
0
        public void IsValidMethodShouldReturnFalseForValidEgnWithParametersAndCustomeMessage(string egn, string message)
        {
            //Премахва повторяемостта ако например тестваме egn с различни стойности
            var validator = new EgnValidator();

            var result = validator.IsValid(egn);

            Assert.IsTrue(result, message);
        }
Example #4
0
        public void IsValidAcceptsNullAsParameter(string egn, string message)
        {
            //Arrange
            var validator = new EgnValidator();

            //Assert
            Assert.Throws <ArgumentNullException>(
                () => validator.IsValid(egn), message);
            //Assert.IsFalse(condition, message); // All are false
        }
Example #5
0
        public void IsValidShouldReturnFalse(string egn, string message)
        {
            //Arrange
            var validator = new EgnValidator();

            //Act
            var condition = validator.IsValid(egn);

            //Assert
            Assert.IsFalse(condition, message); // All are false
        }
Example #6
0
        public void IsValidShouldReturnTrue(string egn)
        {
            //Arrange
            var validator = new EgnValidator();

            //Act
            var result = validator.IsValid(egn);

            //Assert
            Assert.AreEqual(result, true);     // true -> a valid Egn
        }
        public void isValidMethodShouldReturnFalse(string egn)
        {
            // Arrange
            EgnValidator validate = new EgnValidator();

            // Act
            bool result = validate.IsValid(egn);

            // Assert
            Assert.IsFalse(result);
        }
        public void isValidMethodShouldReturnTrueForValidEgnFor20thCentury(string egn)
        {
            // Arrange
            EgnValidator validate = new EgnValidator();

            // Act
            bool result = validate.IsValid(egn);

            // Assert
            Assert.AreEqual(true, result);
        }
Example #9
0
        public void IsValidMethodShouldReturnTrueForValidEgn()
        {
            Console.WriteLine("In test");
            //steps;
            //1. Arrange
            var validator = new EgnValidator();

            //2. Act
            var result = validator.IsValid("6101057509");

            //3. Assert
            Assert.IsTrue(result);
        }
        public void IsValidMethodShouldThrowAnException()
        {
            EgnValidator validate = new EgnValidator();

            try
            {
                validate.IsValid(null);
                Assert.Fail();
            }
            catch
            {
            }
        }