Exemple #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);
        }
Exemple #2
0
        public void IsValidMethodHandlingNullException()
        {
            Console.WriteLine("In test");
            var validator = new EgnValidator();

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

            var result = validator.IsValid(egn);

            Assert.IsTrue(result, message);
        }
        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
        }
        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
        }
        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);
        }
Exemple #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
            {
            }
        }